-->
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: em.find() fails but an HQL query succeeds
PostPosted: Sat Dec 13, 2008 3:38 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Hibernate Annotations 3.4.0.GA
Hibernate 3.3.1.GA

Name and version of the database you are using:

PostgreSQL 8.2

Description of the Problem:

I ran into a rather perplexing issue where I had a @OneToOne(optional=false, mappedBy="foo") and em.find(...) returned null but a query using select returned the object I wanted. Apparently em.find(...) was using an inner join and the select wasn't, so the object couldn't be returned because the related object was no longer related. Confusing but definitely my fault.


Originally this was going to be a question, but now it's just a warning - yet another reason to avoid @OneToOne! It''s dangerous!


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.