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 |
From: <leg...@at...> - 2003-10-23 21:07:40
|
The following comment has been added to this issue: Author: Gavin King Created: Thu, 23 Oct 2003 1:29 PM Body: six votes....it doing pretty well.... --------------------------------------------------------------------- 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 |
From: <leg...@at...> - 2004-02-09 13:20:38
|
The following comment has been added to this issue: Author: Cameron Braid Created: Mon, 9 Feb 2004 7:19 AM Body: Have any plans been finalized ? I don't mind either way.. Our current soloution is a hibernate source hack to create a PersistentStringEnum class, and this sux when upgrading to newer hibernate versions. --------------------------------------------------------------------- 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: Open Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Mon, 9 Feb 2004 7:19 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 |
From: <leg...@at...> - 2004-02-09 14:25:33
|
The following comment has been added to this issue: Author: Bertrand Renuart Created: Mon, 9 Feb 2004 8:24 AM Body: I wrote a set of generic UserTypes to handle this situation... Is it worth to post them on the Wiki ? --------------------------------------------------------------------- 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: Open Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Mon, 9 Feb 2004 8:24 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 |
From: <leg...@at...> - 2004-02-09 14:36:32
|
The following comment has been added to this issue: Author: Cameron Braid Created: Mon, 9 Feb 2004 8:36 AM Body: that would be a good idea. thanks. --------------------------------------------------------------------- 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: Open Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Mon, 9 Feb 2004 8:36 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 |
From: <leg...@at...> - 2004-02-09 15:30:33
|
The following comment has been added to this issue: Author: Stefano Travelli Created: Mon, 9 Feb 2004 9:28 AM Body: I'd like to see such a set of UseTypes. I was thinking about something like this. Sorry for not updating the patch for 2.1. I'm quite busy with the rest of my project and still stick with hibernate 2.0.3. --------------------------------------------------------------------- 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: Open Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Mon, 9 Feb 2004 9:28 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 |
From: <leg...@at...> - 2004-02-09 17:56:33
|
The following comment has been added to this issue: Author: Bertrand Renuart Created: Mon, 9 Feb 2004 11:56 AM Body: Have posted our implementation on the WikiArea (under Technical Patterns). Sorry for the lack of detailled explanation but no time for the moment (deadline is too close :-( Feel free to comment on the wiki or the forum. --------------------------------------------------------------------- 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: Open Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Mon, 9 Feb 2004 11:56 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 |
From: <leg...@at...> - 2004-05-12 17:30:54
|
The following comment has been added to this issue: Author: Stefano Travelli Created: Wed, 12 May 2004 12:39 PM Body: Agree with the decision. For those who's interested (and to be LGPL compliant for the patched hibernate that I'm distributing) I attach the patch for version 2.1.3. However, I will no longer support this patch for future releases. I'm going to refactor my enumeration types with custom types as Bertrand suggested in the wiki, but I reworked his code in order to have two abstract classes, one for enumerations in numeric fields and one for enumerations in string fields. Enumeration values mapping are provided in the constructor of the concrete type class. Example: public class MyEnumType extends IntEnumType { public MyEnumType() { super(MyEnum.class, new Object[] { MyEnum.FIRST_VALUE, MyEnum.SECOND_VALUE, MyEnum.THIRD_VALUE }, new Object[] { new Integer(1), new Integer(2), new Integer(3) }); } } Or: public class MyEnumType extends StringEnumType { public MyEnumType() { super(MyEnum.class, new Object[] { MyEnum.FIRST_VALUE, MyEnum.SECOND_VALUE, MyEnum.THIRD_VALUE }, new Object[] { "A", "B", "C" }); } } Enumeration classes don't need to be Apache enums. Maybe this will be valuable when we'll have JSR-201 enums. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-27?page=comments#action_13103 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-27 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-27 Summary: Persistent String Enum Type: Patch Status: Closed Priority: Minor Resolution: WON'T FIX Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Wed, 12 May 2004 12:39 PM 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 |
From: <leg...@at...> - 2004-05-12 17:39:53
|
The following comment has been added to this issue: Author: Stefano Travelli Created: Wed, 12 May 2004 12:49 PM Body: Ops... It seems that (reasonably) one cannot attach other files in a closed issue. Who needs the code, please e-mail me (stefano.travelli <at> formula.it) --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-27?page=comments#action_13104 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-27 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-27 Summary: Persistent String Enum Type: Patch Status: Closed Priority: Minor Resolution: WON'T FIX Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Assignee: Gavin King Reporter: Max Rydahl Andersen Created: Sat, 3 May 2003 10:15 AM Updated: Wed, 12 May 2004 12:49 PM 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 |