Hi,

I have a requirement for my Customer object to contain an ordered collection of 
Script child objects, and to be able to display these in in table with move up 
and move down functionality.

My first thought was to store these in a List and use Hibernate's @IndexColumn. 
However, I'm not sure what would happen if 2 users fetch the data and then both 
create a new Script. Won't the 2nd user to save get an exception because 
Hibernate will try to assign the a duplicate value to the index column of this 
second object (i.e. it will be the same as the first objects and the database 
will disallow the CREATE because of unique constraint)?

Am I correct in my thinking?

As an alternative, I could just use a ordered Set and manually manage the index 
column. Is this a better solution? If so, I assume I would need to override the 
EntityHome.persist method in my ScriptHome, and in this method add a query to 
select the max(index) and then assign this value + 1 to my Script's index 
property.

Is this a better solution?

Thanks,

Lawrie 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021573#4021573

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021573
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to