-->
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: Urgent : Interceptor question, Lifecyle question.
PostPosted: Wed Sep 24, 2003 9:51 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 8:27 am
Posts: 36
I am facing two very similar peoblems.

The First peoblem is that I have a composite key for which i am supplying the key values based on certain criteria.

Now, i have a screen from which i can get objects that are not yet persisted or also some objects that are persisted in the database and need to be updated.

Now i did try to veto with LifeCyle. And for a not yet persisted object if hibernate tries to update it, then i am doing a Veto, however it does not naturally then try to save that object.

So, in the documentation i read about Interceptor and the is "isUnsaved()" method. The challange i have with that is there is no class that i know of that implements a default interceptor, and that i can just override the "isUnsaved()" method.

What is the best way i can solve this, and if interceptoer is the way how can i use the interceptor with just implementing "isUnsaved()" method.

The other problem is similar a problem in a collection cascade.

I have a 4 level collection cascade, and in this scenario also, i have some objects that have to updated and some that have to be saved, at all levels.
Again i tried lifecyle and it faces the same problem as above.

What i mean by 4 level collection ascade is, A is one to many with B, B has one to many with C, C has one to many with D, and in any of these many's(B,C,D) there may be a new Object or a Persistant object needing to be updated.

I have set casacde-all in the mapping. So i am calling SaveOrUpdate(A), after i fill all the objects and i can clearly see that it is trying to Update rows that need to be inserted. As a side note i have KeyGen class for generating the ID's in this case for all levels of Objects(A,B,C,D).

I guess the way i will solve the first problem i wil also solve the next problem.

Thanks and Regards
Suchak Jani


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.