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: Interceptor.isUnsaved() and Interceptor.onSave()
PostPosted: Tue Oct 19, 2004 4:11 pm 
Regular
Regular

Joined: Fri Oct 08, 2004 4:11 am
Posts: 78
Location: Nottingham, England
Hi,
how do I correctly implement the above, in respect to both my map and my Class in terms of the syntax i use and where I place it?


Hibernate version:
2.1

Mapping documents:
<class name="Order" table="orderstbl">
<id name="ID" column="order_id">
<generator class="assigned"/>
</id>
<version name="version" column="version" type="integer"/>
<property name="PriceTotal" column="price_total" type="double" not-null="true"/>
<property name="OrderDate" column="order_date" type="timestamp" not-null="true"/>
<property name="UserID" column="user_id" type="integer" not-null="true"/>
<set name="OrderItems" inverse="true" cascade="all-delete-orphan">
<key column="order_id"/>
<one-to-many class="OrderItem"/>
</set>
</class>

Code between sessionFactory.openSession() and session.close():
transaction = session.beginTransaction();

session.save(myOrder);

transaction.commit();
Util.closeSession();

many thanks


Andrew


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:10 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Don't get me wrong, your questions are good and polite, but... after you posted quite a few in the last days, don't you think its better to spend more time with the documentation and try things for yourself? A forum posting should be the "last cry for help", not "lets see if someone does my homework". Please also reread this page: http://www.hibernate.org/ForumMailingli ... AskForHelp

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:36 pm 
Regular
Regular

Joined: Fri Oct 08, 2004 4:11 am
Posts: 78
Location: Nottingham, England
Christian,
I agree exactly with what you are saying. Hence the reason I exaust all possibilities before I request for help here!

many thanks


Andrew


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I don't think you do because I know that our documentation about Interceptors should be enough for you to figure out such an extremely simple problem (it isn't even a problem, you just didn't read _any_ documentation about it).

The problem is, we can easily see if someone read the docs or not and, most people here don't have much patience if someone doesn't follow "all possibilites", as you said. So, in the spirit of good communication, please first spend more time on the documentation and follow the other pointers (searching, FAQ, etc.) given in the HowToAskForHelp before asking more questions like this.

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:50 pm 
Regular
Regular

Joined: Fri Oct 08, 2004 4:11 am
Posts: 78
Location: Nottingham, England
Christian,
what you need to know is this, that sign that say 'New User', means exactly that. I'm a musician, not a programmer, who's is trying to setup a going concern. Java, hibernate are until a few weeks ago were totally new concepts to me. So when I see some terminoligy, you will have to forgive me, but I don't know what it means until I can familiarise myself with the code. I hope you appreciate where I am coming from here, i'm not interested in anybody doing my *homework* as you put it. And if you follow the trail of a number of my questions I think you will be able to see that i have done enough research to at least know what the source of many of the problems i have are.

many thanks


Andrew


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 6:48 pm 
Regular
Regular

Joined: Fri Jan 16, 2004 4:48 am
Posts: 56
beyarecords,

If you are sometimes unable to follow the documentation (perfectly understandable, just theory is useless without practicals) , have a look at the hibernate test cases .The test cases are pretty exhaustive and will give you a lot of insight of how things are done. Tr y to build small simple models and expand slowly on them as you go deeper.

- Shishir


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 6:56 pm 
Regular
Regular

Joined: Fri Oct 08, 2004 4:11 am
Posts: 78
Location: Nottingham, England
Shishir,
thank you very much for your comments.. I will take on board what you have said.


regards


Andrew


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.