Joined: Tue Dec 14, 2004 11:49 am Posts: 2 Location: Toulouse, France
|
Hibernate version:
2.1.6
Name and version of the database you are using:
MySQL 4.1.10
Hi all,
I'm trying to map a class to a DB table in which the PK is composed of a string column (FK) AND a integer index, which should be autogenerated (it's pretty weird, but I can't change the schema). It's as follow:
CREATE TABLE T_TOTO {
TOTO_NAME VARCHAR (PK)
...
}
CREATE TABLE T_TITI {
TITI_INDEX INTEGER AUTO INCREMENT (PK)
TOTO_NAME VARCHAR (PK) (FK)
...
}
I successfully tried to map other tables with composite PKs by defining Id classes whose fields map the PK columns. In this particular case I'm a a loss finding how to retrieve the autoincremented column value from DB. The generator="native" attribute only seems to work for non-composite PKs. I'd like to leverage Hibernate IdentifierGenerator implementations but I can't figure out exactly how I can achieve that.
Any help will be greatly appreciated. Regards,
Baptiste
|
|