This is the exception I'm getting
Code:
Caused by: java.sql.SQLException: Unknown Parameter: 13
at com.google.cloud.sql.jdbc.ParameterMetadata.getParameterType(ParameterMetadata.java:45)
at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:121)
at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:155)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2705)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2682)
at org.hibernate.persister.entity.AbstractEntityPersister$4.bindValues(AbstractEntityPersister.java:2863)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 111 more
Full exception is here - http://pastebin.com/9sNVjeRQ
Here is my hibernate mapping for enums in the entity
Code:
<property name="userStatus" column="user_status" insert="true" update="true" index="true">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">com.tutorial.enums.UserStatus</param>
<param name="type">12</param>
</type>
</property>
<property name="userType" column="user_type" insert="true" update="true" index="true">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">com.tutorial.enums.UserType</param>
<param name="type">12</param>
</type>
</property>
I remove the enums from my entity then entity is getting persisted properly. Need help with this.
I've asked the same question here also. http://stackoverflow.com/questions/13191508/hibernate-unable-to-save-entity-with-one-of-the-fields-as-enum