Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 841786

Summary: SessionInfo table doesn't get the MySQL AUTO_INCREMENT flag on EAP6
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Lukáš Petrovický <lpetrovi>
Component: BRE (Expert, Fusion)Assignee: Nobody <nobody>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: kverlaen, mbaluch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:20:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
AS Config (the relevant DS is java:/jBPMDS
none
persistence.xml
none
persistence.xml for H2DB none

Description Lukáš Petrovický 2012-07-20 08:59:19 UTC
Created attachment 599337 [details]
AS Config (the relevant DS is java:/jBPMDS

When trying the jBPM console out with EAP6 and MySQL 5.5, I have stumbled into the following exception:

Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
	at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
	at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03-icedtea]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03-icedtea]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03-icedtea]
	at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03-icedtea]
	at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.1.3.Final-redhat-1.jar:4.1.3.Final-redhat-1]
	... 75 more

Turns out, it is caused by the SessionInfo table, which doesn't have the AUTO_INCREMENT flag set. The exact same codebase works with EAP5, suggesting this must be a difference between JPA1 and JPA2.

See attached AS config and persistence.xml.

Comment 1 Lukáš Petrovický 2012-07-20 09:00:13 UTC
Created attachment 599338 [details]
persistence.xml

The persistence.xml exhibiting the issue.

Comment 2 Tomas Schlosser 2012-08-28 11:21:16 UTC
Created attachment 607479 [details]
persistence.xml for H2DB

The same exception occurs if you use default EAP6 database. I include persistence.xml from business-central.war that is set up to use JPA2 classes. The exact exception is:

Caused by: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "ID"; SQL statement:
     insert into SessionInfo (id, lastModificationDate, rulesByteArray, startDate, OPTLOCK) values (null, ?, ?, ?, ?)

Comment 3 Jiri Svitak 2012-08-29 15:39:53 UTC
The same exception happens with MS SQL Server 2008 when using Hibernate 4 on EAP 6.0:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'id', table 'dballo01.dbo.SessionInfo'; column does not allow nulls. INSERT fails.

Comment 4 Marco Rietveld 2012-08-30 19:22:59 UTC
Figured this out, it's basically this, I think: 
- https://hibernate.onjira.com/browse/HHH-6648

The work-around/fix is to add the following line to your persistence.xml:

<property name="hibernate.id.new_generator_mappings" value="false" />

We're making EAP 6 specific wars (console-server, human-task) and the persistence.xml files used in both will include the following: 

      <!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->      
      <property name="hibernate.id.new_generator_mappings" value="false" />

Comment 5 Marco Rietveld 2012-08-31 11:37:53 UTC
The jbpm-distribution module now creates gwt-console-server and jbpm-human-task wars for EAP6 (classifier: EE6). 

Both of these now contain persistence.xml files with the lines mentioned above.

Comment 6 Radovan Synek 2012-09-21 10:12:28 UTC
Verifier on 5.3.1.BRMS-ER1 (works with brms-p-5.3.1.ER1-deployable-ee6).

Comment 7 lcarlon 2012-11-06 01:36:14 UTC
Marked as not needing release notes as deploying to EAP6 isn't supported until 5.3.1

Comment 14 Red Hat Bugzilla 2025-02-10 03:20:19 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.