I can generate and exception on EntityManager.find with an nonexistent id when used after a load of same id, simple example:
Code:
UserEntity unused = entityManager.getReference(UserEntity.class, notExistingId); //Coment this line and no exception is thrown
UserEntity isNull = entityManager.find(UserEntity.class, notExistingId); // ---> Exception
I noted this when using hibernate Session that may be a "feature" but now this is against standard JPA i think:
http://download.oracle.com/javaee/6/api ... lang.Class, java.lang.Object)
Code:
...
Caused by: javax.persistence.EntityNotFoundException: Unable to find es.qrr.buda.dao.impl.jpa.user.UserEntity with id 1234321
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:137) [:3.6.6.Final]
at org.hibernate.event.def.DefaultLoadEventListener.returnNarrowedProxy(DefaultLoadEventListener.java:320) [:3.6.6.Final]
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:277) [:3.6.6.Final]
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152) [:3.6.6.Final]
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090) [:3.6.6.Final]
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005) [:3.6.6.Final]
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998) [:3.6.6.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:614) [:3.6.6.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:589) [:3.6.6.Final]
....
Should this be reported? Thanks.