diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/internal/DdlTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/internal/DdlTypeImpl.java index 4a7c0d56fe..e90b444e7d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/internal/DdlTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/internal/DdlTypeImpl.java @@ -114,13 +114,15 @@ public class DdlTypeImpl implements DdlType { } else { //use the given length/precision/scale - if ( precision != null && scale == null ) { + final Size size = dialect.getSizeStrategy() + .resolveSize( jdbcType, javaType, precision, scale, length ); + if ( size.getPrecision() != null && size.getScale() == null ) { //needed for cast(x as BigInteger(p)) - scale = javaType.getDefaultSqlScale( dialect, jdbcType ); + size.setScale( javaType.getDefaultSqlScale( dialect, jdbcType ) ); } return castTypeNamePattern == null - ? getTypeName( length, precision, scale ) - : replace( castTypeNamePattern, length, precision, scale ); + ? getTypeName( size.getLength(), size.getPrecision(), size.getScale() ) + : replace( castTypeNamePattern, size.getLength(), size.getPrecision(), size.getScale() ); } } diff --git a/hibernate-core/src/test/resources/mappings/subselectfetch/Name.hbm.xml b/hibernate-core/src/test/resources/mappings/subselectfetch/Name.hbm.xml index b5ef91f866..ab1594ef85 100644 --- a/hibernate-core/src/test/resources/mappings/subselectfetch/Name.hbm.xml +++ b/hibernate-core/src/test/resources/mappings/subselectfetch/Name.hbm.xml @@ -12,10 +12,10 @@ - + - + diff --git a/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction.hbm.xml index 13b474ab79..fdd58269e8 100644 --- a/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction.hbm.xml @@ -13,7 +13,7 @@ package="org.hibernate.orm.test.bidi"> - + @@ -25,13 +25,13 @@ - id + c_id true - + - + @@ -27,7 +27,7 @@ - + @@ -37,7 +37,7 @@ column="auctionId" cascade="persist"/> - exists(select a.id from TAuction2 a where a.successfulBid=id) + exists(select a.c_id from TAuction2 a where a.successfulBid=c_id) diff --git a/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction3.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction3.hbm.xml index b2e164be36..1861b04576 100644 --- a/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction3.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/orm/test/bidi/Auction3.hbm.xml @@ -13,7 +13,7 @@ package="org.hibernate.orm.test.bidi"> - + @@ -25,13 +25,13 @@ - id + c_id true - +