Hi, Is it possible to have a customtype for ID column and still use Identity for id generation. Here is my code database is sybase.
<id name="clientId" type="Typedef_ClientId" unsaved-value="null" > <column name="client_id" precision="12" scale="0" /> <generator class="identity" /> </id> <property name="clientCode" type="string"> <column name="client_cd" length="15" not-null="true" /> </property>
------- <typedef name="Typedef_ClientId" class="com.myapp.dao.hibernate.type.HibernateIntegerIdType"> <param name="targetClass">com.myapp.type.ClientId</param> </typedef>
With the above code i get exception when inserting new record Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:116) at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:92) at org.hibernate.id.IdentityGenerator$InsertSelectDelegate.executeAndExtract(IdentityGenerator.java:145)
|