OpenJPA is in the process of creating the tables when an error occurs. It
looks like a syntax error from the database over the AUTO_INCREMENT
keyword. I didn't find any hits on the sql state and error code though.

Are there any chained exceptions? A nested SQLException might have a more
helpful message.

I did try the SQL statement on a local copy of MySQL and I was able to
create the table manually, so I don't think there are any syntax errors. As
a last resort you could try running the SQL manually too, and see if it has
trouble with any other tables.

-mike




On Thu, Oct 17, 2013 at 7:33 AM, wlad <vvo...@yahoo.com> wrote:

> Hi,
> I am (new to JEE) working with: EJB3, Apache TomEE plus 1.5.2, openjpa as
> persistence provider, MySQL database,  Eclipse IDE.
> I'm trying to run simple EJB with JPA example but getting this error:
>
> "<openjpa-2.2.0-r422266:1244990 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: unexpected token:
> AUTO_INCREMENT {stmnt 15634609 CREATE TABLE gorivo (gorivo_id INTEGER NOT
> NULL AUTO_INCREMENT, gorivo_tip VARCHAR(255) NOT NULL, PRIMARY KEY
> (gorivo_id), UNIQUE U_GORIVO_GORIVO_ID (gorivo_id)) ENGINE = innodb}
> [code=-5581, state=42581]
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
>         at
>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
>         at
>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
>         ......
> "
>
> The example should demonstrate creating and deploying an EJB bean to a
> server, accessing it using its JNDI name, and calling its method (persist,
> update, remove, list some entities).
> From what I understood is that annotated entities in the project should
> map/create mysql db tables if it is configured in persistence.xml file.
>
> When I deploy this project (as jar) to TomEE server, and start TomEE,
> openjpa does not create/map entities to mysql tables (no tables in mysql
> when i check it from terminal).
> I am not sure have I configured persistence.xml correctly, where
> persistence
> unit looks like this:
>
>   <persistence-unit name="Vezbe07Primer02"
> transaction-type="RESOURCE_LOCAL">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>     <properties>
>
>       <property name="openjpa.ConnectionURL"
> value="jdbc:mysql://localhost:3306/xyDB"/>
>       <property name="openjpa.ConnectionDriverName"
> value="com.mysql.jdbc.Driver"/>
>       <property name="openjpa.ConnectionUserName" value="root"/>
>       <property name="openjpa.ConnectionPassword" value="123"/>
>
>       <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" />
>       <property name="openjpa.jdbc.DBDictionary" value="mysql" />
>       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO" />
>     </properties>
>   </persistence-unit>
>
> I believe this should be due some obvious setting i am missing, or not
> doing
> correctly.
> Appreciate any help or advice.
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Persistence-xml-configuration-OpenJPA-not-mapping-entities-to-mysql-db-tp7585208.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Reply via email to