[hibernate-issues] [Hibernate-JIRA] Commented: (HB-232) Custom types cannot be uses for ids with indentity and sequence generators

Patrick Lisser (JIRA) noreply at atlassian.com
Mon Aug 14 06:27:19 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HB-232?page=comments#action_23919 ] 

Patrick Lisser commented on HB-232:
-----------------------------------

Is there any news on that issue (wrapping natively generated id's with custom types)?

Or any known workarounds?

by the way, I'm using Hibernate 3.1

> Custom types cannot be uses for ids with indentity and sequence generators
> --------------------------------------------------------------------------
>
>          Key: HB-232
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-232
>      Project: Hibernate2
>         Type: Improvement

>   Components: core
>     Versions: 2.0rc2
>  Environment: Any environment.  MySql DB
>     Reporter: James Lewis
>     Assignee: Gavin King
>     Priority: Minor
>      Fix For: 2.1 beta 1

>
>
> All of my persistent objects have a custom primary key object.  
> For instance, my Part object has a PartID as the key.  This allows me to perform compile time type checking in my service layer.
> I was ably to create a UserType that converted the coulmn type of integer to PartID.  No problem, it worked great.  However, the IdentityGeneratorFactory throw an exception because my custom types return PartID.class as the return type.  The IdentityGeneratorFactory's 'get' method only takes classes that are of type Integer.class, Long.class, and Short.class.  The API should be changed so that the get method returns a Serializable instead of a Number, and takes a Type instead of a class.  This would allow the IdentityGeneratorFactory to return the custom class type.
> What are your thoughts.
> James

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list