|
Mapping that uses tables in multiple schemas cause major problems with hbm2ddl and perhaps later if the tables are created manually.
I need to us multiple schema because my application contains several entities in different packages with the same class and table names. Attempting to add them results in hbm2ddl puking.
I have provided a test case that replicates my issue. It assumes it will be have access to a mysql server on localhost accessable with user='root', password=''. If that is the case you should be able to replicate the error by unpacking the attachement and running "mvn spring-boot:run" in the resultant "test" directory. Two obvious errors result from this.
1) Entities in schema "testB" that share a name with one schema "testA" (MyObject) do not get created. 2) Entities in schema "testB" with relationships to entities in "testA" attempt to create foreign keys that reference "testB" rather than "testA". Here is the error HHH000388: Unsuccessful: alter table testB.something_different add constraint FK_1l5kto5n6dw2hcsuqsk5hmkqa foreign key (other_object_id) references testB.other_object (id)
There are several other issues logged in the output but I believe the two above are the root cause of most of them.
This may not be affecting many people but it is a blocker for me which is why I have marked it as such. It is also possible that my annotation configuration is causing the problem, but I don't believe so because they appear to be what is recommended for this case by others and I have used this type of configuration successfully in the past with Hibernate 3.x series.
All your help is appreciated.
|