[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-607) Save a new Object and the version is set to 1 instead of 0

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:28 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-607.
------------------------------


Closing stale resolved issues

> Save a new Object and the version is set to 1 instead of 0
> ----------------------------------------------------------
>
>                 Key: HHH-607
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-607
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>         Environment: Postgress, Windows XP
>            Reporter: Julien Vallet
>
> Hi,
> I have made a class like this:
> public class TestVersionCounter
> {
>   public TestVersionCounter()
>   {
>   }
>   public Blob getConverted_serializableUserObjectTypedCollection()
>   {
>       return HibernateConverterSet.convertSerializableUserObjectTypedCollection(serializableUserObjectTypedCollection);
>   }
>   public void setConverted_serializableUserObjectTypedCollection(Blob aBlob)
>   {
>     try
>     {
>       serializableUserObjectTypedCollection=(SerializableUserObjectTypedCollection)SerializationHelper.deserialize(aBlob.getBinaryStream());
>     }
>     catch (Throwable throwable)
>     {
>       
>     }
>   }
>   public Long getInternalKey()
>   {
>     return internalKey;
>   }
>   public void setInternalKey(Long theInternalKey)
>   {
>     internalKey=theInternalKey;
>   }
>   public String getName()
>   {
>     return name;
>   }
>   public void setName(String theName)
>   {
>     name=theName;
>   }
>   public int getVersionCounter()
>   {
>     return versionCounter;
>   }
>   public void setVersionCounter(int theVersionCounter)
>   {
>     versionCounter=theVersionCounter;
>   }
>   protected SerializableUserObjectTypedCollection serializableUserObjectTypedCollection;
>   private Blob converted_serializableUserObjectTypedCollection;
>   private String name=null;
>   private Long internalKey=null;
>   private int versionCounter=0;
> }
> with a mapping like this:
>   <class name="com.sgcib.ibd.opp.tests.TestVersionCounter" table="TTestVersionCounterOPP" lazy="false" >
>     <id name="internalKey" >
>       <generator class="assigned" />
>     </id>
>     <version name="versionCounter" column="version" type="int" />
>     <property name="name" column="name" length="255" />
>     <property name="converted_serializableUserObjectTypedCollection" column="serializableUserObjectT" />
>   </class>
> When I do
> TestVersionCounter testVersion=new TestVersionCounter();
> session.save(userObject);
> the version saved in the Database is 1 and not 0.
> Do you think this is a normal behaviour ?
> Thank you
> Regards.
> Julien.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list