table A and B need to have 1:M relationship
a and b are added during application runtime, so A created, then say
4 B's created. Each B instance has to come in order, so that I could later
extract them in the same order as I added them.
The app will be a web-app running on Tomcat, so 10 instances may work simultaneously.
So my question are:
1) How to preserve inserting order, so that I could extract B instances that A references in the
same order as I persisted them. That's tricky, because we add to a Collection and then it gets saved (am I right?). So, it depends on how Hibernate saves it, what if it changes the order in what we added instances? I've seen something like LIST instead of SET when describing relationships, is that what I need?
2) How to add a 3-rd column to B so that I could differentiate the instances, something like
SEX(M,F,U) in B table. Do I need a special table, or there's and easy way to describe constants in Hibernate. What do you recommend?
3) Talking about concurrency, what methods do you recommend to use? There should be no collisions
in the db and as you see, there might easily be some if rows are not inserted (PK added) right
where it is invoked without delays ?