tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AndrewClarke <s...@clarke.ca>
Subject OpenJPA/Hibernate won't create/edit tables
Date Fri, 16 Aug 2013 20:56:18 GMT
I'm having lots of problems with OpenJPA and/or Hibernate on TomeEE startup. 
It seems like this used to be working and now it's not, so I'm not sure what
I've done wrong.  Here's an example of what happens with a table when I
start TomEE:

2013-08-16 16:44:02,219 ERROR [localhost-startStop-1]
tool.hbm2ddl.SchemaExport.perform(425): HHH000389: Unsuccessful: alter table
User add index FK_dfc815c8d2a74750ab18b9d1f35 (organizationId), add
constraint FK_dfc815c8d2a74750ab18b9d1f35 foreign key (organizationId)
references Organization (id)
2013-08-16 16:44:02,219 ERROR [localhost-startStop-1]
tool.hbm2ddl.SchemaExport.perform(425): HHH000389: Unsuccessful: alter table
User add index FK_dfc815c8d2a74750ab18b9d1f35 (organizationId), add
constraint FK_dfc815c8d2a74750ab18b9d1f35 foreign key (organizationId)
references Organization (id)
2013-08-16 16:44:02,220 ERROR [localhost-startStop-1]
tool.hbm2ddl.SchemaExport.perform(426): Table 'example_db_prod_innodb.user'
doesn't exist
2013-08-16 16:44:02,220 ERROR [localhost-startStop-1]
tool.hbm2ddl.SchemaExport.perform(426): Table 'example_db_prod_innodb.user'
doesn't exist

Yes, I get each Hibernate log entry twice.  No, I don't know why.

I originally had a populated database and was getting all sorts of errors
trying to create foreign key constraints, indexes, etc.  Each time I started
TomEE it would try to create more indexes and constraints, without dropping
old ones.  Eventually I thought I'd start with an empty database, which is
where I am now.  No matter how I set up persistence.xml, I can't get it
working.  Here's what I have at the moment:


<?xml version="1.0" encoding="UTF-8"?>
<persistence
        xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0"
        >
    <persistence-unit name="ExampleEngine" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <properties>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
        </properties>
    </persistence-unit>
</persistence>


I'd really appreciate any ideas or insight.

Thank you very much,
- Andrew.



--
View this message in context: http://openejb.979440.n4.nabble.com/OpenJPA-Hibernate-won-t-create-edit-tables-tp4664696.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message