Everything runs fine locally but when I deploy my .ear and ds.xml I get the following error on startup:
MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails
The table schema is created from the entity annotations and in my persistence.xml I have:
<persistence-unit name="ooord"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/ooordDatasource</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/ooordEntityManagerFactory"/> </properties> </persistence-unit>
Why would this work locally but not when deployed? Same user, same password and also GRANT ALL.
Im stumped.
interesting....
i rearranged the insert statements in my import.sql and it worked. Why then did it not blow up locally?