java - Hibernate: Issue with mapping Enum Property Type -


followed every step mentioned in tutorial still getting following exception:

caused by: org.hibernate.mappingexception: unable instantiate custom type: org.hibernate.type.enumtype  caused by: java.lang.nullpointerexception     @ org.hibernate.type.enumtype.setparametervalues(enumtype.java:203) [hibernate-core-4.2.0.final.jar:4.2.0.final]     @ org.hibernate.type.typefactory.injectparameters(typefactory.java:131) [hibernate-core-4.2.0.final.jar:4.2.0.final] 

part 2

then tried using @enumerated itself. changed hbm <property name="gender" column="usr_gender" not-null="true" type="org.hibernate.type.enumtype">.

entity class:

import javax.persistence.enumerated; import javax.persistence.enumtype;     @enumerated(enumtype.string)        gender gender 

still getting same error.

part 3

update hbm property <property name="gender" column="usr_gender" not-null="true" type="string">.
kept entity class same. got old error. expected type: gender, actual value: java.lang.string

hbm file

<property name="shortname" column="short_name" type="string" not-null="true"/> <property name="description" column="description" type="string" not-null="true"/> <property name="gender" column="gender_type" not-null="true" type="string"/> 

entity class

import javax.persistence.enumerated; import javax.persistence.enumtype;  private string shortname; private string description; @enumerated(enumtype.string) private tenant tenant; 

i got same exception when tried create custom type enum field give type argument addscalar() method sqlquery. not clear part of code throws exception. seems trying create custom type overcome exception due argument mismatch of setter method enum on result transformation. please see answer hibernate sql transformation fails enum type field.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -