-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: EntityNotFoundException on EntityManager.find is against JPA
PostPosted: Thu Nov 03, 2011 1:30 pm 
Newbie

Joined: Thu Nov 03, 2011 1:13 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.