I'm using hibernate in a web application under JBoss , and i've implemented an hilo generator for all my classes.
This means that i cannot use saveOrUpdate method because i don't know if a given ID is a new id or an old one.
My suggestion is to append an object to a Session whan opened.
So it would be
sessionFactory.openSession(HiLoGenerator);
Then , implementig all persistent objcts as LifeCycle I could say that id is not saved when it's null and implement onSave method like:
public boolean onSave(Session s) {
setId( new Long( ((HiLoGenerator)sI.getHelperObject()).inc()) ); return net.sf.hibernate.Lifecycle.NO_VETO;
}
so at the end i can retrive my hi and lo numbers .
I war trying to implement it , but all classes are final, and so I have prefered to ask here before; and maybe it's a bad idea.
What do u suggest?
Caio, kiuma
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel