Hi all,
In the Hibernate 4.0.0.Beta1, when I passed the property of 'hibernate.hbm2ddl.auto=create' into EntityManagerFactory, it will help me create the database script, which is generated by Hibernate itself, properly. However, with upgrading to the Hibernate 4.0.0.CR2, I've found before running the creation script, it will run the drop script, which result in throwing out some ERROR message. I've checked the hibernate source code, found the following change. (in SchemaExport.java)
Code:
/**
* Run the schema creation script; drop script is automatically
* executed before running the creation script.
*
* @param output the target of the script.
*/
public void create(Target output) {
// need to drop tables before creating so need to specify Type.BOTH
execute( output, Type.BOTH );
}
Before, it was TYPE.CREATE.
The problem with running database drop script firstly is that it will throw ERROR message when running the foreign key constraints drop statement, as those tables were not existed at first time. ERROR messages are like following:
Code:
18:27:24,818 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) Table "BPEL_MESSAGE_ROUTE" not found; SQL statement:
alter table BPEL_MESSAGE_ROUTE drop constraint FKD55AB687DB5AB781 [42102-145]
18:27:24,821 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) HHH00389:Unsuccessful: alter table BPEL_MEX_PROP drop constraint FKAE75920CAA079EB8
18:27:24,822 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) Table "BPEL_MEX_PROP" not found; SQL statement:
alter table BPEL_MEX_PROP drop constraint FKAE75920CAA079EB8 [42102-145]
18:27:24,822 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) HHH00389:Unsuccessful: alter table BPEL_PARTNER_LINK drop constraint FKA7809BBB21712AFA
Do we have any configurations (or workarounds) to remove this sort of error?
Thanks
Jeff