Hello,
Here's an example table that looks like what I'm trying to work with:
Code:
table: parent
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(45) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
table: child
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| parent_id | int(11) | NO | PRI | NULL | |
| id | int(11) | NO | PRI | NULL | |
| name | varchar(45) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
As you can see, parent's ID is auto-increment but child's is not... The idea here is that each child would have a key like 1-1, 1-2, 1-3 and 2-1, 2-2, 2-3 and so on...
Is there a way Hibernate can create those keys for me? I'm trying to NOT use auto-increment on child's ID field because I wanna make it "human-readable" like the example above.