I use the following header for my persistent entity classes:
@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class CounterShard implements Serializable
{
private static final long serialVersionUID = 1L;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String sEncodedKey;
@Persistent
@Extension(vendorName="datanucleus", key="gae.pk-id",
value="true")
private Long loID;
@Persistent
private String sCounterName;
// ...
}
I can search for persisted instances of this class by either encoded
key string or ID - both generated automatically by GAE at persistence-
time.
Also, are you using the
identityType = IdentityType.APPLICATION
class annotation as mentioned by A Stevko above?
On Feb 10, 11:29 pm, Cosmin Stefan <[email protected]>
wrote:
> Hey guys,
>
> Well I still haven't figured this out until now. I get the error from
> time to time and it's very odd. Also, now I've started to get a weird
> error while trying to GET data from the server:
>
> (javax.jdo.JDOFatalUserException): Error in meta-data for
> friendfinder.gserver.GMeeting: No primary key defined.
>
> while trying to access a Meeting entry from the DB.
>
> To repeat myself, the problem is that: In JDO, after I persist an
> object to the DB, I want to use it's newly created ID field to create
> a many-to-many relationship. Even though I called pm.refresh() and
> pm.retrieve() to try and update the info, it crashes. The weird thing
> is that, even though it crashes after I've "persisted" the object
> (while trying to access one of its fiels), the change doesnt appear in
> the datastore. I am NOT using TRANSACTIONS (I tried even with them-
> same result).
>
> Could it be because I'm using Long field for ID and not Key?
>
> Thanks!
--
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.