[ 
https://issues.jboss.org/browse/JBSEAM-2389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marek Novotny closed JBSEAM-2389.
---------------------------------

    Fix Version/s:     (was: The future)
       Resolution: Out of Date

    
> HibernatePersistenceProvider fails with java.lang.Integer version check
> -----------------------------------------------------------------------
>
>                 Key: JBSEAM-2389
>                 URL: https://issues.jboss.org/browse/JBSEAM-2389
>             Project: Seam 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: Christian Bauer
>            Priority: Critical
>
> 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, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues

Reply via email to