Ticket #67 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Hibernate generated UserType should hold TYPE constant

Reported by: amandel Owned by: amandel
Priority: major Milestone: unscheduled
Component: code-generators Version: trunk
Keywords: Cc:

Description

Hibernate separates the UserType? interface from the actual Type interface that is used when a Type is passed via an API to Hibernate. For example SQLQuery.addScalar(...) requires a type.

Fortunately a adapter class CustomType? is part of Hibernate that can be used to get a Type out of a UserType?.

The generated UserTypes? should hold a constant (CustomType? is immutable) TYPE that holds the Type version of the UserType?.

Change History

Changed 3 years ago by amandel

  • status changed from new to accepted

Changed 3 years ago by amandel

Unfortunately we can not use:

  public static final org.hibernate.type.Type TYPE
    = new org.hibernate.type.CustomType(<xsl:value-of select="$classname"/>.class, null);

this will cause a cyclic dependency since the CustomType? constructor creates an instance of the UserType? class. This would happen while loading of the CustomType? class.

Changed 3 years ago by amandel

  • status changed from accepted to closed
  • resolution set to fixed

Implemented with [1441]. The generated *UserType? now has a static method getType that returns the appropriate Hibernate Type.

Note: See TracTickets for help on using tickets.