-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to stop Hibernate retrieving rows with "" iden
PostPosted: Tue Mar 21, 2006 10:30 am 
Newbie

Joined: Sat Apr 23, 2005 6:06 pm
Posts: 6
Hi Guys,

If anyone can tell me how to prevent hibernate from retrieving rows which have invalid indetifiers. For example: I am working on a legacy DB and some old data within the database has tables which have foreign keys as " ".

I have mapped my hibernate objects with appropriate relationships so that Table A has a foreign key column to Table B. however the FK in Table A has a value of " ". So when hibernate loads object A it tries to find a row which is equal to " " in Table B: i.e so it can load the mapped object B.

because no row with the identifier exists of object B a hibernate exception is thrown

I want to know how to tell hibernate to not look for Object B if its identifier is " ". Because I have lots of old data the " " cannot be removed.

Thanks in advance


Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 12:19 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
not-found="ignore|exception" (13)

http://www.hibernate.org/hib_docs/v3/re ... -manytoone

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 12:38 pm 
Newbie

Joined: Sat Apr 23, 2005 6:06 pm
Posts: 6
Thanks for the reply, unfortuantely what I forgot to mention in my previous post is I am using HIbernat 2.1 and the attribute is not available there.

Is there something equivalent in 2.1?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.