-->
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: Inverse Cascade too confusing !!!
PostPosted: Mon Aug 27, 2007 3:27 am 
Beginner
Beginner

Joined: Wed Aug 22, 2007 5:53 am
Posts: 38
In case of Item -> Bid Bidirectional Association

Item.hbm.xml

code:


<!-- Item - Bid Association - One-to-Many -->
<set name="bids"
inverse="true"
cascade="all-delete-orphan">
<key column="ITEM_ID" />
<one-to-many class="Bid"/>
</set>



Item.java

code:


public void addBid(Bid bid)
{
System.out.println("Inside addBid(Bid bid)");
bid.setItem(this);
this.bids.add(bid);
}




Can you please justify the output in the following cases :
Case 1:
inverse="true"
bid.setItem(this);
RESULT : No Error. No INERST statement

Case 2:
inverse="false"
bid.setItem(this);
RESULT : No Error. No INERST statement

Case 3:
inverse="true"
this.bids.add(bid);
RESULT : Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: Bid.item

Case 4:

inverse="false"
this.bids.add(bid);
RESULT : Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: Bid.item


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 27, 2007 6:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Either actually _read_ the book or go to the regular user forum. Nobody here will "justify" anything for you. Also learn how to post correctly highlighted code with [ code ] tags, and post full code not useless snippets.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 9:28 am 
Beginner
Beginner

Joined: Wed Aug 22, 2007 5:53 am
Posts: 38
christian wrote:
Either actually _read_ the book or go to the regular user forum. Nobody here will "justify" anything for you. Also learn how to post correctly highlighted code with [ code ] tags, and post full code not useless snippets.


Is this not a regular user forum? What is this forum all about ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 10:23 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This forum is for comments about the content of two books. Now, if you have a question about the book content, you need to

- phrase your question in a way that people understand, in plain english

- show any relevant code not just random lines

- use code tags to format the code so people can read it

If the code you are posting is NOT from the examples in the book, line by line, or ideally from the code you can download (CaveatEmptor), then you are probably in the wrong forum.

From the questions you are asking (as far as I understand them) I can see that you have probably not read the book, or that you should read it again, or that you did not try the downloadable WORKING code.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.