-->
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: How to have 0 in my "OneToOne and not get an error?
PostPosted: Fri Jul 03, 2009 4:11 pm 
Newbie

Joined: Sun Mar 27, 2005 1:22 pm
Posts: 15
Hi,

I wonder if someone can help me?

I am trying to load an object (Team) which has a OneToOne declaration to another object (Group ).

Code:
@OneToOne()
@JoinColumn(name = "DEFAULT_GENERAL_GROUP_ID", nullable = true)   
private Group defaultGeneralGroup ;


In one particular instance I would like Team to have no Group, therefore the value in the DB is 0. The problem is if I try to load the object (Team) with a group value of 0 I get.

Quote:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.forum.dao.Group#0]
org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:377)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:145)


IS there a way to tell hibernate to ignore the 0 value and not try to go and get a group of 0? As you can see I have tried using nullable = true.

Many thanks for any help.


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.