Hi all,
i really have a strange behaviour in my EJB-Application:
I've a J2SE-client who connects to a JBoss via JPA with Hibernate and tries to import a lot of entities to a local database.
My entity beans are configured fine as well (the same code on J2SE-Client and JEE-AS).
Im using a J2SE-persistence context which is configured as follows:
Code:
<persistence-unit name="ClientLocal" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source />
<properties>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.connection.driver_class" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/dblocal"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.connection.username" value="***"/>
<property name="hibernate.connection.password" value="***"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="jdbc.connection.string" value="jdbc:mysql://localhost:3306/dblocal"/>
<property name="jdbc.user" value="***"/>
<property name="jdbc.password" value="***"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
All is running really fine, but i get the following exception after commiting on my J2SE-client:
Code:
18618 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1364, SQLState: HY000
18618 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Field 'id' doesn't have a default value
18619 [main] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
The field "id" is declared as
Code:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long id;
and it should be the job of the underlying framework to set this key.
The problem is also solvable by discarding the EntityManagerFactory between the single transactions (what finally causes an OutOfMemory-Exception because it seems to be very memory-intensive).
Any ideas???
Thanks in advance
Daniel