-->
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.  [ 7 posts ] 
Author Message
 Post subject: not transient, and not detached...
PostPosted: Fri Sep 29, 2006 2:40 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
Hi,

I have objects that have no ids, but already exists in the database. They are not transient, and not detached...
But when I will save a new object with as attribute the above described object, I receive the following exception :
Code:
Exception in thread "AWT-EventQueue-0" org.springframework.orm.hibernate3.HibernateSystemException: not-null property references a null or transient value: be.(...).creator; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: be.(...).creator
org.hibernate.PropertyValueException: not-null property references a null or transient value:

What do you suggest?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 3:13 am 
Beginner
Beginner

Joined: Fri Jun 02, 2006 1:23 am
Posts: 27
Doesn't that just mean a property that you have declared in your hbm.xml file as 'not-null="true"' is null in the object you are trying to save?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 3:26 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
the attribute is not null, it is an instantiated object (new...), that don't come from the database (has no id), but exists in the database (with same unique-key)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 4:03 am 
Beginner
Beginner

Joined: Fri Jun 02, 2006 1:23 am
Posts: 27
Its not clear what you are trying to do..

The API for org.hibernate.PropertyValueException clearly states,
Quote:
Thrown when the (illegal) value of a property can not be persisted. There are two main causes:

* a property declared not-null="true" is null
* an association references an unsaved transient instance

Need help adding information to you posts? Read,

http://www.hibernate.org/ForumMailinglists/HowToAskForHelp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 5:49 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
The attribute of the main object is instanciated (so not null), it exists in the database but it doesn't come from Hibernate (I did no explicit 'find'). Hibernate sees it as transient, but it exists already in the database!
So, what is the way to save my main object, wihtout doing a 'find' of my attribute on his unique key so my attribute is no considered as transient anymore.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 7:07 am 
Newbie

Joined: Thu Aug 31, 2006 7:56 am
Posts: 14
are any of the attributes on your instanciated object null?, you will get this error for any of the fields, not just the key field.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 7:25 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
No, my attributes are not null.... there are all new instances that already exist in the database, but not already get by Hibernate...


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