This content has been marked as final.
Show 7 replies
-
1. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:07 PM (in response to andrigtmiller)Known bug, I have scheduled this for Oct 6 release. It throws a hibernate specific exception correct?
-
2. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:08 PM (in response to andrigtmiller)Sorry, here it is in jira;
http://jira.jboss.com/jira/browse/EJBTHREE-297 -
3. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:27 PM (in response to andrigtmiller)FYI, call a property on the returned entity and it will throw Hibernate specific ObjectNotFound.
-
4. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:31 PM (in response to andrigtmiller)Also, just call find() instead and test for null.
-
5. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:31 PM (in response to andrigtmiller)Jeez, sorry,
getReference() should throw EntityNotFound, but it doesn't
find() returns null. -
6. Re: EntityManager find for primary key lookup not throwing E
andrigtmiller Sep 17, 2005 8:39 PM (in response to andrigtmiller)Thanks, I thought it probably was a bug. Good to see its already on the schedule to be fixed. For now, I can continue with the createQuery stuff, and I'll change it after the October 6th release.
-
7. Re: EntityManager find for primary key lookup not throwing E
bill.burke Sep 17, 2005 8:39 PM (in response to andrigtmiller)Ok, yet another message :)
getReference *MAY* throw, ENFE, or, it may throw ENFE immediately after a property is accessed.
Javadoc:If the requested instance does not exist in the database, * throws EntityNotFoundException when get is called or * when the instance state is first accessed.
In other words, use find and throw your own ENFE if the method does not exist.