Skip to content
mrumpf edited this page Jun 18, 2012 · 2 revisions

The SimpleTypesGenerator can on demand generate Hibernate User Type for usage with Hibernate Mappings. For all types except the ValueObject.

The UserTypes have the following characteristics:

  • The types implement the UserType interface as required by Hibernate
  • The generated class name is the name of the enum class with UserType appended.
  • Can be used as type in the property definition in the HBM file. Please note that you need to define the UserType as type to get a mapping to the associated generated type. For this to work buth classes must be available compiled on the classpath whenever the hbm is read.
  • Sometimes it is to get the UserType as Type to fullfill the Hibernate API eg. in SQLQuery.addScalar(...). Therefor each UserType has a static method getType() that returns the Hibernate Type. A usage sample could be: query.addScalar("ACTOR_ID", UserIdUserType.getType());
Clone this wiki locally