HIbernate schema update failed

I get the following stack when starting the Jboss server. I wonder why JPA is trying to modify tables that seem fine and how to pass these ERROR messages. Thanks to

2009-08-03 11: 28: 49.683 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Failed: modify table BDPARAMS add constraint FK61733C48FA34BFDC foreign key (ITEMID) links RTELEMENT 2009-08-03 11: 28: 49.683 ERROR [org .hibernate.tool.hbm2ddl.SchemaUpdate] Failed: modify table BDPARAMS add constraint FK61733C48FA34BFDC foreign key (ITEMID) links RTELEMENT 2009-08-03 11: 28: 49.683 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate75] OchemaUpdate such a reference constraint already exists in the table

2009-08-03 11: 28: 49,683 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] ORA-02275: such a reference constraint already exists in the table

2009-08-03 11: 28: 49,745 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Failed: modify table CONTENTITEM add constraint FK692B5EEC44F32395 foreign key reference (parent_id) CONTENTLOCATION 2009-08-03 11: 28: 49,745 ERROR [ org.hibernate.tool.hbm2ddl.SchemaUpdate] Failed: modify table CONTENTITEM add constraint FK692B5EEC44F32395 foreign key reference (parent_id) CONTENTLOCATION 2009-08-03 11: 28: 49,745 ERROR [org.hibernate.tool.hbm2ddate] O22 : such a reference constraint already exists in the table

+2


source to share


4 answers


In my case, the problem was solved when I added the name default_schema to the Hibernate config file:

<property name="hibernate.default_schema" value="db_default_schema_name" />

      



Specifically in Play Framework 2.4, I added the above line to the file conf\META-INF\persistence.xml

.

Hibernate version used: 4.3.11

+4


source


I had similar errors, and the problems arose due to inaccuracies in the fetching of metadata by the jdbc subsystem. The metadata is returned to say that hibernation does not exist, but it actually does not - maybe for a number of reasons. I would suggest trying other dbms, maybe the problem is with user differences between the current and the user generating the table. There may also be something wrong with your display.



But ultimately the only sure-fire way to fix this is to turn off schema sync on startup.

+1


source


In my case, the error messages came up after changing the java package structure in my project. I think hibernate was a little confused.

I had similar errors (alter table ... add constraint) and I am using Oracle DB 10g. For me, the simplest solution was to export the data of the respective tables (inserts), delete it, run the application that creates the tables again, and then import the table data again. Then Hibernate creates the tables again and the error messages go away!

+1


source


I had the same error but fixed it with a few simple steps.

Dump the current database Mysqldump out current.sql Modify hibernate.cfg to create so it recreates the database table Dump the new database Mysqldump out new.sql

Copy new create table to current reinsert database mysql in current.sql

+1


source







All Articles