[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1936) IdentityGenerator doesn't support BigInteger as a valid identity type.

Michel Nolard (JIRA) noreply at atlassian.com
Tue Apr 14 05:18:18 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32864#action_32864 ] 

Michel Nolard commented on HHH-1936:
------------------------------------

Maybe nobody noticed it yet but this issue is nearly 3 years old !

It needs to be tackled down in an elegant and quick way for it appears in a very common use case : when using DBMS native ID systems
E.g: using Oracle, one creates a table whose ID is a value generated from a sequence -> the bug occurs
E.g: using Sybase, one creates a table whose ID is an auto-incremented value -> the bug occurs
E.g: using SQL Server, one creates a table whose ID is an auto-incremented value -> the bug occurs
...
the complete list is quite long.

I think 3 years for this simple thing is quite long... don't you think ?

Instead of adding the "not so JDBC standard compliant" implementation in the main IdentifierGeneratorFactory ( which is bad and I understand it), there should at least be an optional not fully compliant (but USEFUL) implementation providing the following seamless mappings:
 Oracle's NUMBER( p, 0 ) -> BigInteger
 Sybase-SqlServer's auto-increment -> BigInteger

Thanks by advance,

Michel Nolard


> IdentityGenerator doesn't support BigInteger as a valid identity type.
> ----------------------------------------------------------------------
>
>                 Key: HHH-1936
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.5
>         Environment: Hibernate 3.0.5,  Sybase 12.05, Window/ Unix
>            Reporter: Leonid Shtivelman
>         Attachments: IdentifierGeneratorFactory.java
>
>
> Identity generator strategy doesn't support BigInteger as a valid id type. This causes problem with Sybase which requires identity column to be numeric.  It would seem an obvious way to get around this problem is to set column mapping to long in hibernate xml and the actual java object.  This will solve obvious problem of creating identity, but will cause performance problem on selection.  In order for Sybase to use index for parameter query the variable type of the parameter and column index type has to be the same.  If ones maps column type to Long, Hibernate will use JDBC method setLong(long) to set value in the prepared statement.  This will cause mismatch between parameter type and column index type, and Sybase will not use index to locate index.   As you can see this is a big problem for anyone that is using identity columns Sybase and Hibernate

-- 
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