Okay, I have found my answer. You have to persiste the object first
before you could get its generated primary field value. Cheers!

On Jan 28, 4:07 pm, ivanceras <[email protected]> wrote:
> When you instanciate a persisten object in google app engine the
> object automatically is assigned with a value to its primary field
> even before persisting it in the database.
>
> sample class:
> MyClass{
> @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
> private Long id;
>
> }
>
> But in the case with rdbms, the primary field is not assigned with a
> value. Its value is created when the persistent object is saved into
> the database. But I need to use the value of its primary field before
> persisting it. What is the proper way to do this, in a sense it would
> also work using any other underlying supported datasource?

-- 
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.

Reply via email to