did you set <jta-data-source>? without it you will use the default database which can be different from the one you expect (value = id in tomee.xml).
*Romain Manni-Bucau* *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/8/19 AndrewClarke <[email protected]> > Thank you for the response. I think my errors are Hibernate-related > rather than JPA, but as I'm using both I just wasn't sure what is really > causing the errors. > > I've had <property name="hibernate.hbm2ddl.auto" value="update"/> in > general, but I changed it to "create" when I deleted all my tables. I > thought maybe there was a problem with my database, so recreating > everything might resolve the issue. Unfortunately it didn't, as I still > get the errors and nothing is created. > > - Andrew. > > > On 2013-08-17, at 03:43, Romain Manni-Bucau [via OpenEJB] < > [email protected]> wrote: > > > Hi > > > > Why you said you have openjpa errors? > > > > With hibernate using create you should start only once with this setting. > > Le 16 août 2013 22:57, "AndrewClarke" <[hidden email]> a écrit : > > > > > 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. > > > > > > > > > If you reply to this email, your message will be added to the discussion > below: > > > http://openejb.979440.n4.nabble.com/OpenJPA-Hibernate-won-t-create-edit-tables-tp4664696p4664697.html > > To unsubscribe from OpenJPA/Hibernate won't create/edit tables, click > here. > > NAML > > > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/OpenJPA-Hibernate-won-t-create-edit-tables-tp4664696p4664721.html > Sent from the OpenEJB User mailing list archive at Nabble.com. >
