[Hibernate-JIRA] Commented: (HHH-1936) IdentityGenerator doesn't support BigInteger as a valid identity type.
by Guenther Enthaler (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936?page=c... ]
Guenther Enthaler commented on HHH-1936:
----------------------------------------
I'd like to add BigInteger as an allowed type:
...
else if ( clazz == java.math.BigDecimal.class ) {
return rs.getBigDecimal( 1 );
}
else if (clazz == BigInteger.class) {
return rs.getBigDecimal(1).toBigIntegerExact();
}
else {
throw new IdentifierGenerationException( "this id generator generates long, integer, short, biginteger, bigdecimal or string" );
}
Likewise, this is working for us...
> IdentityGenerator doesn't support BigInteger as a valid identity type.
> ----------------------------------------------------------------------
>
> Key: HHH-1936
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, Sybase 12.05, Window/ Unix
> Reporter: Leonid Shtivelman
>
> 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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[Hibernate-JIRA] Commented: (HHH-1936) IdentityGenerator doesn't support BigInteger as a valid identity type.
by Dejan Predovic (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936?page=c... ]
Dejan Predovic commented on HHH-1936:
-------------------------------------
This issue is still open for both 3.2 and 3.3 branches.
We patched it by simply adding BigDecimal as an allowed type:
public static Serializable get(ResultSet rs, Type type) throws SQLException, IdentifierGenerationException {
Class clazz = type.getReturnedClass();
if ( clazz == Long.class ) {
return new Long( rs.getLong( 1 ) );
}
else if ( clazz == Integer.class ) {
return new Integer( rs.getInt( 1 ) );
}
else if ( clazz == Short.class ) {
return new Short( rs.getShort( 1 ) );
}
else if ( clazz == String.class ) {
return rs.getString( 1 );
}
else if ( clazz == java.math.BigDecimal.class ) {
return rs.getBigDecimal( 1 );
}
else {
throw new IdentifierGenerationException( "this id generator generates long, integer, short, bigdecimal or string" );
}
}
and it works, we see no side effects. It would be nice if this could find it's way into the trunk.
> IdentityGenerator doesn't support BigInteger as a valid identity type.
> ----------------------------------------------------------------------
>
> Key: HHH-1936
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, Sybase 12.05, Window/ Unix
> Reporter: Leonid Shtivelman
>
> 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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[Hibernate-JIRA] Created: (HV-53) AssertTrue and AssertFalse not compatible with null values
by benoit heinrich (JIRA)
AssertTrue and AssertFalse not compatible with null values
----------------------------------------------------------
Key: HV-53
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-53
Project: Hibernate Validator
Issue Type: Bug
Components: validators
Affects Versions: 3.0.0.ga
Reporter: benoit heinrich
The AssertTrue and AssertFalse validators do not work with null values, they actually generate a NullPointerException.
The code fix for this should be:
public class AssertFalseValidator implements Validator<AssertFalse>, Serializable {
public boolean isValid(Object value) {
if (value == null) return true; << this is the fix
return !(Boolean) value;
}
public void initialize(AssertFalse parameters) {
}
}
public class AssertTrueValidator implements Validator<AssertTrue>, Serializable {
public boolean isValid(Object value) {
if (value == null) return true; << this is the fix
return (Boolean) value;
}
public void initialize(AssertTrue parameters) {
}
}
Cheers,
/Benoit
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 5 months