Hibernate version: 3.2.4.sp1
Name and version of the database you are using: DB2 UDB for AS/400 iSeries V5R4m0
The generated SQL: alter table DB.Customer add constraint FK26568AABFFF088A foreign key (division_id) references DB1.Division
Error: [SQL5051] Qualifier DB1 not the same as name DB.
These two tables are created successfully by the automatic SQL, however the commands to create the constraints error out. Both tables have annotations to override the default library:
Code:
@Table(schema="DB")
To successfully create this constraint, the name needs to be preceeded by the database library name, ie DB.FK26568AABFFF088A.
The database connection string provides a default, which is set to DB1. The constraint name, without the preceeding library name, is defaulting back to DB1, causing the error. The table and the constraint must exist in the same library, or SQL5051 is thrown.