-->
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.  [ 6 posts ] 
Author Message
 Post subject: Strange PropertyValueException ?????
PostPosted: Mon Dec 08, 2003 10:45 am 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
Hi, all
I get this error and can't undestand why.
Does it mena that property "organization" is null or transient ?

Code:
net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: net.sf.hibernate.persister.EntityPersister.organization


Mapping code:
Code:
<hibernate-mapping>
    <class
        name="com.clearview.feedback.db.report.Report"
        table="report"
        dynamic-update="true"
        dynamic-insert="false"
        mutable="true"
    > .....
        <many-to-one
            name="organization"
            class="com.clearview.feedback.db.Organization"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            column="org_id"
            unique="false"
        />


And there's my code:
Code:
session.refresh(visit.getOrganization());
Report report = new Report(owner, description, status,
report.setMessage(visit.getMessage());
report.setReferenceId(WebUtils.getInstance().generateLogin());
session.beginTransaction();
session.save(report);
session.commit();


And when i try to commit transaction i get such exception. In debug i see that "organization" property in report is not null. Does anyone know what's wrong with my code? I use 2.1 hibernate.

Thank's


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 11:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
It says "null or transient". This means that the object referred to by the associations named "organization" is not yet persistent.

Note that the "net.sf.hibernate.persister.EntityPersister." bit is due to a bug in the exception message in 2.1rc1. It should be the correct classname.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 11:18 am 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
gavin wrote:
It says "null or transient". This means that the object referred to by the associations named "organization" is not yet persistent.

Note that the "net.sf.hibernate.persister.EntityPersister." bit is due to a bug in the exception message in 2.1rc1. It should be the correct classname.


I found that null property has benn in deeper property's class not in Report class. But exception doesn't tell right class name :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 12:02 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you replace net.sf.hibernate.persister.EntityPersister by com.clearview.feedback.db.report.Report as Gavin said, you have an explicit error

Code:
not-null property references a null or transient value: com.clearview.feedback.db.report.Report.organization


Can you give a simple testcase reproducing what you said :

null value in an other part of the Report generate 'com.clearview.feedback.db.report.Report.organization' PropertyValueException.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 12:09 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
Null property was in Report.getUser().getOrganization().
I fixed it and now everything is OK.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 12:14 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Ok so net.sf.hibernate.persister.EntityPersister.organisation was in reality com....User.organisation. This display bug will be corrected in the next hibernate version

_________________
Emmanuel


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