Hello,
Description: When a table does exist in different schemas with the same table name (but e.g. different columns) on the same (oracle) database the schema validation of hibernate does not make sure that the validation is executed against the correct "schema.table". Instead, it takes the first table in the list of metadata tables with the given name regardless of the schema it resides in and validates it against the java entity.
Problem: The order of tables in that list is determined by the creation time. Hence, if the table against which the validation shall
not occur, is further up the list the validation is executed against the wrong table.
Possible "
Solutions":
- If the table against which the validation shall not occur is dropped and recreated it is further down in the list and will not be used for validation since the "correct" table now is further up and used. => Not a practical solution since it involves manual dropping and creating tables.
- Turn off validation. => Not a real solution since we need the validation.
- Use schema attribute of javax.persistence.Table in the java entity to specify the schema of the table or specify a default schema to be used for all tables. However, the reason to have the same table in different schemas is that every developer has its own schema. So each developer would need his own version of tables / configuration. => Not a practical solution.
Is that issue known? Is there a solution in hibernate (other than the above mentioned or using different names for tables in each schema)?
Regards,
Ballone