-->
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.  [ 4 posts ] 
Author Message
 Post subject: question one-to-one association and outer join result
PostPosted: Tue Dec 30, 2003 4:44 pm 
Newbie

Joined: Tue Dec 30, 2003 4:27 pm
Posts: 1
Hello, I'm new to hibernate and there's a behavior I don't undersand:

I have 2 tables linked by a one-to-one association.

For a test purpose, I do a hql query in a servlet to select on record from the parent table.
In the child table, there is no correspondant record for the particular parent table record.

So the sql query generated by hibernate returns correctly a classic outer join with one record from the parent table outer joined with a null record from the child table. This is ok.

But what I don't understand is that in my java servlet that does the query, I got the following message "No row with the given identifier exists: xxx, of class: child table"

But the hql query I made in the servlet, concerns just the parent table, but because of the one-to-one association, hibernate generates the outer join with the child table.

So why does the java resultset not return a row whereas the sql outer joint returns well a record ?

I hope I'm clear !!!

Olivier Steinberg

Thank's for help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 4:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just an idea, have you tried using the $ syntax in your mapping documents, like de.blabla.A$B where B is your inner class, and A your outer? This may work, but maybe just for static inner classes, I don't think for normal inner classes.

I don't really think Hibernate can persist normal inner classes, on retrieval, the link to the parent would have to be created somehow, and I don't think this is possible ... but maybe Hibernate surprises me once more ;) Does someone else know something about this?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 4:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Oh sorry, this went to the wrong thread ... arrrgh. Better go to bed


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
There is probably a not-null="true" or something in your mapping that force Hibernate to expect the corresponding child. Wo mapping it's hard to tell

_________________
Emmanuel


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

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.