-->
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: Use of Entity Interceptor is unclear
PostPosted: Wed Jun 15, 2005 6:16 am 
Newbie

Joined: Mon Nov 22, 2004 6:24 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.2

Mapping documents:
<set
name="masquesChamps"
table="MASQUECHAMP"
lazy="true"
cascade="all"
inverse="false"
>
<key column="ID_MASQUE" />

<one-to-many class="com.orange.greco.persistance.dao.masque.bean.MasqueChampsTO" />

</set>
...

<class
name="com.orange.greco.persistance.dao.masque.bean.MasqueChampsTO"
table="MASQUECHAMP"
>

<composite-id >
<key-many-to-one name="masque" class="com.orange.greco.persistance.dao.masque.bean.MasqueTO" column="ID_MASQUE" />
<key-many-to-one name="champ" column="ID_CHAMPAFFICHE" class="com.orange.greco.persistance.dao.references.bean.ChampsAfficheTO" />
</composite-id>
<property name="rangChampsAffiche" type="java.lang.Integer" column="RANG" />
</class>



When I try to save a MasqueTO Object, Hibernate issue an update statement onto children MasqueChampsTO objects instead of insert statement.

After browsing through documentation, possible solutions are :
-Adding Timestamp column to MasqueChampsTO table
( this solution is not possible to me)
- using Interceptor for MasqueChampsTO entity in order to find out if the object must be saved or updated.

Setting up the interceptor for MasqueChampsTO entities is not obvious to me.
Must an interceptor be bound to the hibernate session ?
In such case, I can register only one interceptor into my application and my interceptor code must switch between every entity instance.
I believe a better solution exists

Could anyone explain me how to register an Entity interceptor for a single class to the Hibernate Session ?

Sincerely,
Bob


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.