[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-2389) HibernatePersistenceProvider fails with java.lang.Integer version check

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon Dec 17 09:20:43 EST 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-2389?page=all ]

Pete Muir updated JBSEAM-2389:
------------------------------

    Fix Version/s: 2.0.1.GA

> 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
>            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