Ohh, sorry.. in the example, I gave a wrong class name
"UnownedRelationLoader"
Its FooEntityListner and still it does not work
public class FooEntityListner {
public void postLoad(BaseEntity entity) {
---
}
---------- Forwarded message ----------
From: Sudhir Ramanandi <[email protected]>
Date: Tue, Jun 8, 2010 at 2:37 PM
Subject: JPA entity listner callbacks are not invoked when using Query API
To: [email protected]
When an entity is loaded using query, postLoad() call back is not invoked.
postLoad() works only with entityManager.find(clazz, id)
As per the JPA specification:
"The PostLoad method is invoked before a query result is returned or
accessed or before an association is traversed."
Example:
@EntityListeners(value={FooEntityListner.class})
@Entity
public class Foo extends BaseEntity {
}
public class UnownedRelationLoader {
public void postLoad(BaseEntity entity) {
---
}
Query q = getEntityManager().createQuery("select from " +
Foo.class.getName());
callback will not be called in above case.
Reported the issue here
http://code.google.com/p/googleappengine/issues/detail?id=3326
Please vote for it.
--
Sudhir Ramanandi
http://www.ramanandi.org
--
Sudhir Ramanandi
http://www.ramanandi.org
--
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.