What you could do is something like this:
public class Employee {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT)
private Long id;
@Persistent private String department;
@Persistent private String firstName;
@Persistent private String lastName;
}
start with id 1, and goes on untill they have reached 2^32 - 1.
Should do the trick.
On Jan 23, 7:25 am, aswath satrasala <[email protected]>
wrote:
> Hi,
> I have an Employee class
> public class Employee {
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
> private String id;
>
> @Persistent private String department;
> @Persistent private String firstName;
> @Persistent private String lastName;
>
> }
>
> Now, I want to provide a EmployeeID to the employee. I will not be able to
> provide gae.encoded-pk value as this is long and not meaningful.
> Further, I want to provide the EmployeeID with department as the prefix.
> How can I generate the EmployeeID, similar to sequence in the relational
> world.
>
> -Aswath
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.