[Building Sakai] Hibernate UserType in kernel/kernel-private

Duffy Gillman duffy at rsmart.com
Thu Mar 3 07:55:36 PST 2011


I'd like to move a class from jobscheduler to kernel/kernel-private because it has general utility to tools using Hibernate. The class is called EnumUserType and is an implementation of the code found here:

	http://community.jboss.org/wiki/UserTypeforpersistinganEnumwithaVARCHARcolumn

This class is useful for persisting Enum value types using Hibernate. EnumUserType uses generics to implement a custom Hibernate UserType for any Enum type you care to persist. Subclassing EnumUserType and binding its Type parameter to the Enum of interest generates the code required for Hibernate to manage that Enum type. An example can be seen in the jobscheduler/scheduler-event-model module. See org.sakaiproject.scheduler.events.hibernate.TriggerEventEnumUserType and its use in the Hibernate mapping org.sakaiproject.scheduler.events.hibernate.TriggerEventHibernateImpl.hbm.xml in the same module.

Since kernel/kernel-private seems to have all the framework level support for Hibernate in Sakai this seemed like the appropriate place. If there are no arguments for an alternate spot I'd like to move forward on this change so EnumUserType can be used in other modules outside of jobscheduler/scheduler-event-model.

Cheers,

   Duffy Gillman
   Sr. Software Engineer
   The rSmart Group, Inc.


More information about the sakai-dev mailing list