Hi. I am having some problems with my hibernate mapping. Please take a look at the hbm files:
The list is necessary for the address, as I want to preserve the order of these elements (well, the real problem has different classes, but this is the simplest one that depicts what my question is).
The DDL that get's generated is:
The code for the classes is the simplest possible, just to make SchemaExport work:
As you can see, the join table has the primary key wrong, right? I would like it to be (person_id, adress_id). When it is like this, it could violate the contraint - a single person could be in different Address's collections, and on the same position (so that person_id and IDX are the same, but not address_id). Why is the IDX in the join table anyway, not in the Person table?
Please, help me configure it properly.
this would generate some items in the Person_Address join table, and to know that address1 is at index 0 and address2 is at index 1 it needs the IDX so that when you get back the data from the DB the order is preserved.
for your real problem i can't help you. i usually write my DDL by hand and then map it to hibernate using annotations, i never generate DDL SQL automatically.
Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
posted 9 years ago
I thought maybe it would be stored in the Person table, don't know why. Thanks.