From: <leg...@at...> - 2003-09-07 04:55:27
|
The following comment has been added to this issue: Author: Gavin King Created: Sat, 6 Sep 2003 11:54 PM Body: OK, the implementation is perfect. I just can't seem to decide b/w two possible courses of action: (1) accept this patch (2) deprecate PersistentEnum entirely and tell people to _always_ use a UserType, which eliminates domain model dependencies upon Hibernate The purist approach is definately (2), but PersistentEnum IS kinda convenient... --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-27 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-27 Summary: Persistent String Enum Type: Patch Status: Assigned Priority: Minor Project: Hibernate2 Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Thu, 15 May 2003 4:38 AM Description: Persistent String Enum PersistentEnum type is a very userfull feature, but in the legacy data world it happens that some enumerations are stored in "char" columns instead of integer and, as far as I understood, I can map a persistent enumeration only with integer. Mapping my existing data I found several char(2) fields that would be nice to map with an enumeration. I tried to write a patch in order to manage such fields introducing a new Hibernate type PersistentStringEnumType and an interface PersistentStringEnum that one can use as the existing PersistenEnum interface. Please, find the modified classes (TypeFactory, MappingByReflection, Hibernate) and the new one (PersistentStringEnum, PersistentEnum) in the attached zip (for Hibernate 1.2) (BTW: Does someone know a simple way to make a patch against CVS?) It also contains a test case for the feature. The test sources explain how to use it. http://sourceforge.net/tracker/index.php?func=detail&aid=684810&group_id=40712&atid=428711 The lenght of the field must be declared in the mapping through the attribute in the <property> tag. I would be nice if we could set it somewhere in the class that define the PersistentStringEnum, but I can't realize if it's possible. stefano Add a Comment: --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |