[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2389) HibernatePersistenceProvider fails with java.lang.Integer version check
Pete Muir (JIRA)
jira-events at lists.jboss.org
Fri Jan 4 18:00:43 EST 2008
[ http://jira.jboss.com/jira/browse/JBSEAM-2389?page=comments#action_12393906 ]
Pete Muir commented on JBSEAM-2389:
-----------------------------------
Yes, I either need reproduction steps or a test case as I can't see from the code how you can end with oldVersion as null (it's initialized from ClassMetaData.getVersion()).
> HibernatePersistenceProvider fails with java.lang.Integer version check
> -----------------------------------------------------------------------
>
> Key: JBSEAM-2389
> URL: http://jira.jboss.com/jira/browse/JBSEAM-2389
> Project: JBoss Seam
> Issue Type: Bug
> Components: Core
> Reporter: Christian Bauer
> Assigned To: Pete Muir
> Priority: Critical
> Fix For: 2.0.1.GA
>
>
> My entity had a version property:
> @Version
> @Column(name = "OBJ_VERSION", nullable = false)
> protected Integer version;
> In a very involved ajax reRender/conversation situation I sometimes got the following exception from HibernatePersistenceProvider:
> public static void checkVersion(Object value, Session session, Object oldVersion, Object version)
> {
> ClassMetadata classMetadata = getClassMetadata(value, session);
> VersionType versionType = (VersionType) classMetadata.getPropertyTypes()[ classMetadata.getVersionProperty() ];
> if ( !versionType.isEqual(oldVersion, version) )
> {
> throw new StaleStateException("current database version number does not match passivated version number");
> }
> }
> This failed because oldVersion was 'null' and version was '0'.
> Hibernate returned '0' from ClassMetaData.getVersion(), it looks like it can't return null, from Javadoc: Get the version number (or timestamp) from the object's version property (or return null if not versioned).
> We should do a null check before asking Hibernate.
> Workaround: Use primitive for version field in entity or initialize it to '0'.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list