-->
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: EntityManager find() and null return
PostPosted: Thu Aug 19, 2010 8:55 pm 
Newbie

Joined: Thu Nov 05, 2009 11:31 am
Posts: 8
Hi, Would someone explain to me under what circumstances a find returns a null when, in fact, a row exists with that primary key. According to Dan (or rather his fine book) find() always hits the database. The underlying DB is MySQL 5.1.48 with the 5.1.10 Connector/J. It might be relegated to when the application is under heavy load. The particular application has an EntityManager per thread so as not to have any multithreaded or concurrency issues.

A secondary question I had was what is the underlying difference between find and select entityObject where primarykey = :key

Where I am confused is if this might be a timing thing although the record existed in the database for in excess of an hour and the LUW lifespan is but a few seconds tops. If, in fact, the find bypasses the Persistence Context and hits the database, I can not fathom why it wouldn't find it. I did verify the key object in the find is the proper type (Long vs Int).

If there is any additional information that might shed light, please let me know.

Thanks,

Walt


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.