Hibernate SVN: r21031 - in search/branches/v3_1_1_GA_CP: src/main/java/org/hibernate/search/store and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2012-05-17 02:50:31 -0400 (Thu, 17 May 2012)
New Revision: 21031
Modified:
search/branches/v3_1_1_GA_CP/pom.xml
search/branches/v3_1_1_GA_CP/src/main/java/org/hibernate/search/store/FSSlaveDirectoryProvider.java
Log:
JBPAPP-8351 [HSEARCH-321] FSSlaveDirectoryProvider incorrectly creates a subdirectory named 0
Modified: search/branches/v3_1_1_GA_CP/pom.xml
===================================================================
--- search/branches/v3_1_1_GA_CP/pom.xml 2012-05-17 05:43:28 UTC (rev 21030)
+++ search/branches/v3_1_1_GA_CP/pom.xml 2012-05-17 06:50:31 UTC (rev 21031)
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
@@ -33,12 +32,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.3.2.GA_CP04</version>
+ <version>3.3.2.GA_CP05</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<packaging>jar</packaging>
- <version>3.1.1.GA_CP04</version>
+ <version>3.1.1.GA_CP05</version>
<name>Hibernate Search</name>
<description>Hibernate Search</description>
@@ -57,7 +56,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>3.3.2.GA_CP04</version>
+ <version>3.3.2.GA_CP05</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
@@ -222,13 +221,13 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
- <version>3.4.0.GA_CP04</version>
+ <version>3.4.0.GA_CP05</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>3.4.0.GA_CP04</version>
+ <version>3.4.0.GA_CP05</version>
<optional>true</optional>
</dependency>
<dependency>
Modified: search/branches/v3_1_1_GA_CP/src/main/java/org/hibernate/search/store/FSSlaveDirectoryProvider.java
===================================================================
--- search/branches/v3_1_1_GA_CP/src/main/java/org/hibernate/search/store/FSSlaveDirectoryProvider.java 2012-05-17 05:43:28 UTC (rev 21030)
+++ search/branches/v3_1_1_GA_CP/src/main/java/org/hibernate/search/store/FSSlaveDirectoryProvider.java 2012-05-17 06:50:31 UTC (rev 21031)
@@ -91,7 +91,7 @@
//no default
log.debug( "Setting directory 1 as current" );
currentToBe = 1;
- File destinationFile = new File( indexDir, Integer.valueOf( readCurrentState ).toString() );
+ File destinationFile = new File( indexDir, Integer.valueOf( currentToBe ).toString() );
int sourceCurrent;
if ( new File( sourceIndexDir, "current1" ).exists() ) {
sourceCurrent = 1;
12 years, 7 months
Hibernate SVN: r21030 - in core/branches/Branch_3_3_2_GA_CP: core/src/main/java/org/hibernate/collection and 14 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2012-05-17 01:43:28 -0400 (Thu, 17 May 2012)
New Revision: 21030
Added:
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/CharInNativeQueryTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.java
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/HbmBinder.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentArrayHolder.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentIdentifierBag.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentList.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/TypeNames.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/function/SQLFunctionTemplate.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/ActionQueue.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParameterParser.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/exception/CacheSQLStateConverter.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/hql/classic/FromParser.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/AbstractQueryImpl.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/CriteriaImpl.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/mapping/Column.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ArrayType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ListType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/StringHelper.java
Log:
JBPAPP-7291 HHH-2304 - Wrong type detection for sql type char(x) columns
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -772,7 +772,7 @@
* @return a human-readable name
*/
public static String isolationLevelToString(int isolation) {
- return (String) ISOLATION_LEVELS.get( new Integer(isolation) );
+ return (String) ISOLATION_LEVELS.get( isolation );
}
public static BytecodeProvider buildBytecodeProvider(Properties properties) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/HbmBinder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/HbmBinder.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/HbmBinder.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -2591,9 +2591,9 @@
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
String region = queryElem.attributeValue( "cache-region" );
Attribute tAtt = queryElem.attribute( "timeout" );
- Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
+ Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() );
Attribute fsAtt = queryElem.attribute( "fetch-size" );
- Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
+ Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() );
Attribute roAttr = queryElem.attribute( "read-only" );
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -59,9 +59,9 @@
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
String region = queryElem.attributeValue( "cache-region" );
Attribute tAtt = queryElem.attribute( "timeout" );
- Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
+ Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() );
Attribute fsAtt = queryElem.attribute( "fetch-size" );
- Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
+ Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() );
Attribute roAttr = queryElem.attribute( "read-only" );
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentArrayHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentArrayHolder.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentArrayHolder.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -207,14 +207,14 @@
int arraySize = Array.getLength(array);
int end;
if ( snSize > arraySize ) {
- for ( int i=arraySize; i<snSize; i++ ) deletes.add( new Integer(i) );
+ for ( int i=arraySize; i<snSize; i++ ) deletes.add( i );
end = arraySize;
}
else {
end = snSize;
}
for ( int i=0; i<end; i++ ) {
- if ( Array.get(array, i)==null && Array.get(sn, i)!=null ) deletes.add( new Integer(i) );
+ if ( Array.get(array, i)==null && Array.get(sn, i)!=null ) deletes.add( i );
}
return deletes.iterator();
}
@@ -233,7 +233,7 @@
}
public Object getIndex(Object entry, int i, CollectionPersister persister) {
- return new Integer(i);
+ return i;
}
public Object getElement(Object entry) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentIdentifierBag.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentIdentifierBag.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentIdentifierBag.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -89,7 +89,7 @@
beforeInitialize( persister, size );
for ( int i = 0; i < size; i+=2 ) {
identifiers.put(
- new Integer(i/2),
+ i/2,
persister.getIdentifierType().assemble( array[i], getSession(), owner )
);
values.add( persister.getElementType().assemble( array[i+1], getSession(), owner ) );
@@ -97,7 +97,7 @@
}
public Object getIdentifier(Object entry, int i) {
- return identifiers.get( new Integer(i) );
+ return identifiers.get( i );
}
public boolean isWrapper(Object collection) {
@@ -202,7 +202,7 @@
int i=0;
for (int j=0; j< values.size(); j++) {
Object value = values.get(j);
- result[i++] = persister.getIdentifierType().disassemble( identifiers.get( new Integer(j) ), getSession(), null );
+ result[i++] = persister.getIdentifierType().disassemble( identifiers.get( j ), getSession(), null );
result[i++] = persister.getElementType().disassemble( value, getSession(), null );
}
return result;
@@ -226,7 +226,7 @@
if ( snap.size()!= values.size() ) return false;
for ( int i=0; i<values.size(); i++ ) {
Object value = values.get(i);
- Object id = identifiers.get( new Integer(i) );
+ Object id = identifiers.get( i );
if (id==null) return false;
Object old = snap.get(id);
if ( elementType.isDirty( old, value, getSession() ) ) return false;
@@ -242,7 +242,7 @@
Map snap = (Map) getSnapshot();
List deletes = new ArrayList( snap.keySet() );
for ( int i=0; i<values.size(); i++ ) {
- if ( values.get(i)!=null ) deletes.remove( identifiers.get( new Integer(i) ) );
+ if ( values.get(i)!=null ) deletes.remove( identifiers.get( i ) );
}
return deletes.iterator();
}
@@ -257,7 +257,7 @@
public Object getSnapshotElement(Object entry, int i) {
Map snap = (Map) getSnapshot();
- Object id = identifiers.get( new Integer(i) );
+ Object id = identifiers.get( i );
return snap.get(id);
}
@@ -265,7 +265,7 @@
throws HibernateException {
Map snap = (Map) getSnapshot();
- Object id = identifiers.get( new Integer(i) );
+ Object id = identifiers.get( i );
return entry!=null && ( id==null || snap.get(id)==null );
}
@@ -273,7 +273,7 @@
if (entry==null) return false;
Map snap = (Map) getSnapshot();
- Object id = identifiers.get( new Integer(i) );
+ Object id = identifiers.get( i );
if (id==null) return false;
Object old = snap.get(id);
return old!=null && elemType.isDirty( old, entry, getSession() );
@@ -289,7 +289,7 @@
Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
Object old = identifiers.put(
- new Integer( values.size() ),
+ values.size(),
persister.readIdentifier( rs, descriptor.getSuffixedIdentifierAlias(), getSession() )
);
if ( old==null ) values.add(element); //maintain correct duplication if loaded in a cartesian product
@@ -307,7 +307,7 @@
while ( iter.hasNext() ) {
Object value = iter.next();
map.put(
- identifiers.get( new Integer(i++) ),
+ identifiers.get( i++ ),
persister.getElementType().deepCopy(value, entityMode, persister.getFactory())
);
}
@@ -324,7 +324,7 @@
int i=0;
while ( iter.hasNext() ) {
Object entry = iter.next();
- Integer loc = new Integer(i++);
+ Integer loc = i++;
if ( !identifiers.containsKey(loc) ) { //TODO: native ids
Serializable id = persister.getIdentifierGenerator().generate( getSession(), entry );
identifiers.put(loc, id);
@@ -377,25 +377,25 @@
}
private void beforeRemove(int index) {
- Object removedId = identifiers.get( new Integer(index) );
+ Object removedId = identifiers.get( (index) );
int last = values.size()-1;
for ( int i=index; i<last; i++ ) {
- Object id = identifiers.get( new Integer(i+1) );
+ Object id = identifiers.get( (i+1) );
if ( id==null ) {
- identifiers.remove( new Integer(i) );
+ identifiers.remove( (i) );
}
else {
- identifiers.put( new Integer(i), id );
+ identifiers.put( (i), id );
}
}
- identifiers.put( new Integer(last), removedId );
+ identifiers.put( (last), removedId );
}
private void beforeAdd(int index) {
for ( int i=index; i<values.size(); i++ ) {
- identifiers.put( new Integer(i+1), identifiers.get( new Integer(i) ) );
+ identifiers.put( (i+1), identifiers.get( (i) ) );
}
- identifiers.remove( new Integer(index) );
+ identifiers.remove( (index) );
}
public Object remove(int index) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentList.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentList.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentList.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -290,7 +290,7 @@
if (index<0) {
throw new ArrayIndexOutOfBoundsException("negative index");
}
- Object result = readElementByIndex( new Integer(index) );
+ Object result = readElementByIndex( (index) );
return result==UNKNOWN ? list.get(index) : result;
}
@@ -301,7 +301,7 @@
if (index<0) {
throw new ArrayIndexOutOfBoundsException("negative index");
}
- Object old = isPutQueueEnabled() ? readElementByIndex( new Integer(index) ) : UNKNOWN;
+ Object old = isPutQueueEnabled() ? readElementByIndex( (index) ) : UNKNOWN;
if ( old==UNKNOWN ) {
write();
return list.set(index, value);
@@ -336,7 +336,7 @@
throw new ArrayIndexOutOfBoundsException("negative index");
}
Object old = isPutQueueEnabled() ?
- readElementByIndex( new Integer(index) ) : UNKNOWN;
+ readElementByIndex( (index) ) : UNKNOWN;
if ( old==UNKNOWN ) {
write();
return list.remove(index);
@@ -442,7 +442,7 @@
int end;
if ( sn.size() > list.size() ) {
for ( int i=list.size(); i<sn.size(); i++ ) {
- deletes.add( indexIsFormula ? sn.get(i) : new Integer(i) );
+ deletes.add( indexIsFormula ? sn.get(i) : (i) );
}
end = list.size();
}
@@ -451,7 +451,7 @@
}
for ( int i=0; i<end; i++ ) {
if ( list.get(i)==null && sn.get(i)!=null ) {
- deletes.add( indexIsFormula ? sn.get(i) : new Integer(i) );
+ deletes.add( indexIsFormula ? sn.get(i) : (i) );
}
}
return deletes.iterator();
@@ -469,7 +469,7 @@
}
public Object getIndex(Object entry, int i, CollectionPersister persister) {
- return new Integer(i);
+ return (i);
}
public Object getElement(Object entry) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -206,6 +206,8 @@
registerHibernateType( Types.BINARY, Hibernate.BINARY.getName() );
registerHibernateType( Types.BIT, Hibernate.BOOLEAN.getName() );
registerHibernateType( Types.CHAR, Hibernate.CHARACTER.getName() );
+ registerHibernateType( Types.CHAR, 1, Hibernate.CHARACTER.getName() );
+ registerHibernateType( Types.CHAR, 255, Hibernate.STRING.getName() );
registerHibernateType( Types.DATE, Hibernate.DATE.getName() );
registerHibernateType( Types.DOUBLE, Hibernate.DOUBLE.getName() );
registerHibernateType( Types.FLOAT, Hibernate.FLOAT.getName() );
@@ -313,12 +315,7 @@
public String getTypeName(int code, int length, int precision, int scale) throws HibernateException {
String result = typeNames.get( code, length, precision, scale );
if ( result == null ) {
- throw new HibernateException(
- "No type mapping for java.sql.Types code: " +
- code +
- ", length: " +
- length
- );
+ throw new HibernateException(String.format( "No type mapping for java.sql.Types code: %s, length: %s", code, length ));
}
return result;
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -63,7 +63,7 @@
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.BINARY, "binary" );
registerColumnType( Types.BIT, "bit" );
- registerColumnType( Types.CHAR, "char(1)" );
+ registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.DECIMAL, "decimal" );
registerColumnType( Types.DOUBLE, "double" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -49,7 +49,7 @@
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TINYINT, "tinyint" );
registerColumnType( Types.INTEGER, "integer" );
- registerColumnType( Types.CHAR, "char(1)" );
+ registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.DOUBLE, "double precision" );
registerColumnType( Types.DATE, "date" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/TypeNames.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/TypeNames.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/TypeNames.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -75,7 +75,7 @@
* @return the default type name associated with specified key
*/
public String get(int typecode) throws MappingException {
- String result = (String) defaults.get( new Integer(typecode) );
+ String result = (String) defaults.get( typecode );
if (result==null) throw new MappingException("No Dialect mapping for JDBC type: " + typecode);
return result;
}
@@ -90,7 +90,7 @@
* if available and the default type name otherwise
*/
public String get(int typecode, int size, int precision, int scale) throws MappingException {
- Map map = (Map) weighted.get( new Integer(typecode) );
+ Map map = (Map) weighted.get( typecode );
if ( map!=null && map.size()>0 ) {
// iterate entries ordered by capacity to find first fit
Iterator entries = map.entrySet().iterator();
@@ -115,12 +115,12 @@
* @param typecode the type key
*/
public void put(int typecode, int capacity, String value) {
- TreeMap map = (TreeMap)weighted.get( new Integer(typecode) );
+ TreeMap map = (TreeMap)weighted.get( typecode );
if (map == null) {// add new ordered map
map = new TreeMap();
- weighted.put( new Integer(typecode), map );
+ weighted.put( typecode, map );
}
- map.put(new Integer(capacity), value);
+ map.put( capacity, value);
}
/**
@@ -128,7 +128,7 @@
* @param typecode the type key
*/
public void put(int typecode, String value) {
- defaults.put( new Integer(typecode), value );
+ defaults.put( typecode, value );
}
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/function/SQLFunctionTemplate.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/function/SQLFunctionTemplate.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/function/SQLFunctionTemplate.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -82,7 +82,7 @@
}
}
- paramList.add( new Integer( Integer.parseInt( index.toString() ) - 1 ) );
+ paramList.add( Integer.valueOf( index.toString() ) - 1 );
index.delete( 0, index.length() );
}
else {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/ActionQueue.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/ActionQueue.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/ActionQueue.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -547,7 +547,7 @@
// doing the batch number before adding the name to the list is
// a faster way to get an accurate number.
- batchNumber = new Integer( actionBatches.size() );
+ batchNumber = ( actionBatches.size() );
latestBatches.put( entityName, batchNumber );
}
entityBatchNumber.put( currentEntity, batchNumber );
@@ -557,7 +557,7 @@
// now rebuild the insertions list. There is a batch for each entry in the name list.
for ( int i = 0; i < actionBatches.size(); i++ ) {
- List batch = ( List ) actionBatches.get( new Integer( i ) );
+ List batch = ( List ) actionBatches.get( ( i ) );
for ( Iterator batchItr = batch.iterator(); batchItr.hasNext(); ) {
EntityInsertAction action = ( EntityInsertAction ) batchItr.next();
insertions.add( action );
@@ -591,7 +591,7 @@
Integer associationBatchNumber = ( Integer ) entityBatchNumber.get( value );
if ( associationBatchNumber != null && associationBatchNumber.compareTo( latestBatchNumberForType ) > 0 ) {
// create a new batch for this type. The batch number is the number of current batches.
- latestBatchNumberForType = new Integer( actionBatches.size() );
+ latestBatchNumberForType = ( actionBatches.size() );
latestBatches.put( entityName, latestBatchNumberForType );
// since this entity will now be processed in the latest possible batch,
// we can be assured that it will come after all other associations,
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -52,7 +52,7 @@
}
private void add(int position) {
- positions.add( new Integer( position ) );
+ positions.add( ( position ) );
}
public int[] buildPositionsArray() {
@@ -102,7 +102,7 @@
// Recognition code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void ordinalParameter(int position) {
- ordinalParameterLocationList.add( new Integer( position ) );
+ ordinalParameterLocationList.add( ( position ) );
}
public void namedParameter(String name, int position) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParameterParser.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParameterParser.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/ParameterParser.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -105,7 +105,7 @@
String param = sqlString.substring( indx + 1, chopLocation );
// make sure this "name" is an integral
try {
- new Integer( param );
+ Integer.valueOf( param );
}
catch( NumberFormatException e ) {
throw new QueryException( "JPA-style positional param was not an integral ordinal" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -274,10 +274,10 @@
final String key = (String) entry.getKey();
final Integer valueCount;
if ( Collection.class.isInstance( entry.getValue() ) ) {
- valueCount = new Integer( ( (Collection) entry.getValue() ).size() );
+ valueCount = ( (Collection) entry.getValue() ).size();
}
else {
- valueCount = new Integer( 1 );
+ valueCount = 1;
}
parameterMetadata.put( key, valueCount );
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/exception/CacheSQLStateConverter.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/exception/CacheSQLStateConverter.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/exception/CacheSQLStateConverter.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -57,14 +57,14 @@
DATA_CATEGORIES.add( "21" );
DATA_CATEGORIES.add( "02" );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 119 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 120 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 121 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 122 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 123 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 124 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 125 ) );
- INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 127 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 119 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 120 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 121 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 122 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 123 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 124 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 125 ) );
+ INTEGRITY_VIOLATION_CATEGORIES.add( ( 127 ) );
CONNECTION_CATEGORIES.add( "08" );
}
@@ -83,7 +83,7 @@
*/
public JDBCException convert(SQLException sqlException, String message, String sql) {
String sqlStateClassCode = JDBCExceptionHelper.extractSqlStateClassCode( sqlException );
- Integer errorCode = new Integer( JDBCExceptionHelper.extractErrorCode( sqlException ) );
+ Integer errorCode = ( JDBCExceptionHelper.extractErrorCode( sqlException ) );
if ( sqlStateClassCode != null ) {
if ( SQL_GRAMMAR_CATEGORIES.contains( sqlStateClassCode ) ) {
return new SQLGrammarException( message, sqlException, sql );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/hql/classic/FromParser.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/hql/classic/FromParser.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/hql/classic/FromParser.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -64,10 +64,10 @@
private static final Map JOIN_TYPES = new HashMap();
static {
- JOIN_TYPES.put( "left", new Integer( JoinFragment.LEFT_OUTER_JOIN ) );
- JOIN_TYPES.put( "right", new Integer( JoinFragment.RIGHT_OUTER_JOIN ) );
- JOIN_TYPES.put( "full", new Integer( JoinFragment.FULL_JOIN ) );
- JOIN_TYPES.put( "inner", new Integer( JoinFragment.INNER_JOIN ) );
+ JOIN_TYPES.put( "left", ( JoinFragment.LEFT_OUTER_JOIN ) );
+ JOIN_TYPES.put( "right", ( JoinFragment.RIGHT_OUTER_JOIN ) );
+ JOIN_TYPES.put( "full", ( JoinFragment.FULL_JOIN ) );
+ JOIN_TYPES.put( "inner", ( JoinFragment.INNER_JOIN ) );
}
public void token(String token, QueryTranslatorImpl q) throws QueryException {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/AbstractQueryImpl.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/AbstractQueryImpl.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/AbstractQueryImpl.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -156,21 +156,21 @@
}
public Query setFirstResult(int firstResult) {
- selection.setFirstRow( new Integer(firstResult) );
+ selection.setFirstRow( (firstResult) );
return this;
}
public Query setMaxResults(int maxResults) {
- selection.setMaxRows( new Integer(maxResults) );
+ selection.setMaxRows( (maxResults) );
return this;
}
public Query setTimeout(int timeout) {
- selection.setTimeout( new Integer(timeout) );
+ selection.setTimeout( (timeout) );
return this;
}
public Query setFetchSize(int fetchSize) {
- selection.setFetchSize( new Integer(fetchSize) );
+ selection.setFetchSize( (fetchSize) );
return this;
}
@@ -505,7 +505,7 @@
}
public Query setInteger(int position, int val) {
- setParameter(position, new Integer(val), Hibernate.INTEGER);
+ setParameter(position, (val), Hibernate.INTEGER);
return this;
}
@@ -629,7 +629,7 @@
}
public Query setInteger(String name, int val) {
- setParameter(name, new Integer(val), Hibernate.INTEGER);
+ setParameter(name, (val), Hibernate.INTEGER);
return this;
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/CriteriaImpl.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/CriteriaImpl.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/impl/CriteriaImpl.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -232,7 +232,7 @@
}
public Criteria setMaxResults(int maxResults) {
- this.maxResults = new Integer(maxResults);
+ this.maxResults = (maxResults);
return this;
}
@@ -241,7 +241,7 @@
}
public Criteria setFirstResult(int firstResult) {
- this.firstResult = new Integer(firstResult);
+ this.firstResult = (firstResult);
return this;
}
@@ -250,7 +250,7 @@
}
public Criteria setFetchSize(int fetchSize) {
- this.fetchSize = new Integer(fetchSize);
+ this.fetchSize = (fetchSize);
return this;
}
@@ -259,7 +259,7 @@
}
public Criteria setTimeout(int timeout) {
- this.timeout = new Integer(timeout);
+ this.timeout = (timeout);
return this;
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -27,6 +27,7 @@
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.sql.Types;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -140,7 +141,7 @@
lockModes.add( rootRtn.getLockMode() );
resultColumnProcessors.add( new NonScalarResultColumnProcessor( returnableCounter++ ) );
nonScalarReturnList.add( rtn );
- entityOwners.add( new Integer( -1 ) );
+ entityOwners.add( ( -1 ) );
resultTypes.add( persister.getType() );
specifiedAliases.add( rootRtn.getAlias() );
entityAliases.add( rootRtn.getEntityAliases() );
@@ -155,7 +156,7 @@
lockModes.add( collRtn.getLockMode() );
resultColumnProcessors.add( new NonScalarResultColumnProcessor( returnableCounter++ ) );
nonScalarReturnList.add( rtn );
- collectionOwners.add( new Integer( -1 ) );
+ collectionOwners.add( ( -1 ) );
resultTypes.add( persister.getType() );
specifiedAliases.add( collRtn.getAlias() );
collectionAliases.add( collRtn.getCollectionAliases() );
@@ -164,7 +165,7 @@
if ( elementType.isEntityType() ) {
Queryable elementPersister = ( Queryable ) ( ( EntityType ) elementType ).getAssociatedJoinable( factory );
entityPersisters.add( elementPersister );
- entityOwners.add( new Integer( -1 ) );
+ entityOwners.add( ( -1 ) );
entityAliases.add( collRtn.getElementEntityAliases() );
ArrayHelper.addAll( querySpaces, elementPersister.getQuerySpaces() );
}
@@ -174,7 +175,7 @@
EntityFetchReturn fetchRtn = ( EntityFetchReturn ) rtn;
NonScalarReturn ownerDescriptor = fetchRtn.getOwner();
int ownerIndex = nonScalarReturnList.indexOf( ownerDescriptor );
- entityOwners.add( new Integer( ownerIndex ) );
+ entityOwners.add( ( ownerIndex ) );
lockModes.add( fetchRtn.getLockMode() );
Queryable ownerPersister = determineAppropriateOwnerPersister( ownerDescriptor );
EntityType fetchedType = ( EntityType ) ownerPersister.getPropertyType( fetchRtn.getOwnerProperty() );
@@ -191,7 +192,7 @@
CollectionFetchReturn fetchRtn = ( CollectionFetchReturn ) rtn;
NonScalarReturn ownerDescriptor = fetchRtn.getOwner();
int ownerIndex = nonScalarReturnList.indexOf( ownerDescriptor );
- collectionOwners.add( new Integer( ownerIndex ) );
+ collectionOwners.add( ( ownerIndex ) );
lockModes.add( fetchRtn.getLockMode() );
Queryable ownerPersister = determineAppropriateOwnerPersister( ownerDescriptor );
String role = ownerPersister.getEntityName() + '.' + fetchRtn.getOwnerProperty();
@@ -205,7 +206,7 @@
if ( elementType.isEntityType() ) {
Queryable elementPersister = ( Queryable ) ( ( EntityType ) elementType ).getAssociatedJoinable( factory );
entityPersisters.add( elementPersister );
- entityOwners.add( new Integer( ownerIndex ) );
+ entityOwners.add( ( ownerIndex ) );
entityAliases.add( fetchRtn.getElementEntityAliases() );
ArrayHelper.addAll( querySpaces, elementPersister.getQuerySpaces() );
}
@@ -612,11 +613,15 @@
int columnType = resultSetMetaData.getColumnType( columnPos );
int scale = resultSetMetaData.getScale( columnPos );
int precision = resultSetMetaData.getPrecision( columnPos );
+ int length = precision;
+ if ( columnType == Types.CHAR && (precision == 0 || precision == Integer.MAX_VALUE) ) {
+ length = resultSetMetaData.getColumnDisplaySize( columnPos );
+ }
return TypeFactory.heuristicType(
factory.getDialect().getHibernateTypeName(
columnType,
+ length,
precision,
- precision,
scale
)
);
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/mapping/Column.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/mapping/Column.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/mapping/Column.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -152,54 +152,54 @@
this.typeIndex = typeIndex;
}
+ public boolean isUnique() {
+ return unique;
+ }
+
public int getSqlTypeCode(Mapping mapping) throws MappingException {
org.hibernate.type.Type type = getValue().getType();
try {
- int sqlTypeCode = type.sqlTypes(mapping)[ getTypeIndex() ];
- if(getSqlTypeCode()!=null && getSqlTypeCode().intValue()!=sqlTypeCode) {
- throw new MappingException("SQLType code's does not match. mapped as " + sqlTypeCode + " but is " + getSqlTypeCode() );
+ int sqlTypeCode = type.sqlTypes( mapping )[getTypeIndex()];
+ if ( getSqlTypeCode() != null && getSqlTypeCode() != sqlTypeCode ) {
+ throw new MappingException( "SQLType code's does not match. mapped as " + sqlTypeCode + " but is " + getSqlTypeCode() );
}
return sqlTypeCode;
}
- catch (Exception e) {
+ catch ( Exception e ) {
throw new MappingException(
"Could not determine type for column " +
- name +
- " of type " +
- type.getClass().getName() +
- ": " +
- e.getClass().getName(),
+ name +
+ " of type " +
+ type.getClass().getName() +
+ ": " +
+ e.getClass().getName(),
e
- );
+ );
}
}
/**
* Returns the underlying columns sqltypecode.
* If null, it is because the sqltype code is unknown.
- *
+ *
* Use #getSqlTypeCode(Mapping) to retreive the sqltypecode used
* for the columns associated Value/Type.
- *
- * @return sqltypecode if it is set, otherwise null.
+ *
+ * @return sqlTypeCode if it is set, otherwise null.
*/
public Integer getSqlTypeCode() {
return sqlTypeCode;
}
-
- public void setSqlTypeCode(Integer typecode) {
- sqlTypeCode=typecode;
+
+ public void setSqlTypeCode(Integer typeCode) {
+ sqlTypeCode=typeCode;
}
-
- public boolean isUnique() {
- return unique;
- }
-
public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
- return sqlType==null ?
- dialect.getTypeName( getSqlTypeCode(mapping), getLength(), getPrecision(), getScale() ) :
- sqlType;
+ if ( sqlType == null ) {
+ sqlType = dialect.getTypeName( getSqlTypeCode( mapping ), getLength(), getPrecision(), getScale() );
+ }
+ return sqlType;
}
public boolean equals(Object object) {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -556,7 +556,7 @@
if ( lazyAvailable && prop.isLazy() ) {
lazyProperties.add( prop.getName() );
lazyNames.add( prop.getName() );
- lazyNumbers.add( new Integer( i ) );
+ lazyNumbers.add( ( i ) );
lazyTypes.add( prop.getValue().getType() );
lazyColAliases.add( colAliases );
}
@@ -711,18 +711,18 @@
int propertyNumber = getSubclassPropertyIndex( lazyPropertyNames[i] );
int tableNumber = getSubclassPropertyTableNumber( propertyNumber );
- tableNumbers.add( new Integer( tableNumber ) );
+ tableNumbers.add( ( tableNumber ) );
int[] colNumbers = subclassPropertyColumnNumberClosure[propertyNumber];
for ( int j = 0; j < colNumbers.length; j++ ) {
if ( colNumbers[j]!=-1 ) {
- columnNumbers.add( new Integer( colNumbers[j] ) );
+ columnNumbers.add( ( colNumbers[j] ) );
}
}
int[] formNumbers = subclassPropertyFormulaNumberClosure[propertyNumber];
for ( int j = 0; j < formNumbers.length; j++ ) {
if ( formNumbers[j]!=-1 ) {
- formulaNumbers.add( new Integer( formNumbers[j] ) );
+ formulaNumbers.add( ( formNumbers[j] ) );
}
}
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -117,7 +117,7 @@
final Object discriminatorValue;
if ( persistentClass.isPolymorphic() ) {
try {
- discriminatorValue = new Integer( persistentClass.getSubclassId() );
+ discriminatorValue = ( persistentClass.getSubclassId() );
discriminatorSQLString = discriminatorValue.toString();
}
catch (Exception e) {
@@ -278,7 +278,7 @@
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
- Integer tabnum = new Integer( getTableId(tabname, subclassTableNameClosure) );
+ Integer tabnum = ( getTableId(tabname, subclassTableNameClosure) );
propTableNumbers.add(tabnum);
Iterator citer = prop.getColumnIterator();
@@ -336,7 +336,7 @@
// we now use subclass ids that are consistent across all
// persisters for a class hierarchy, so that the use of
// "foo.class = Bar" works in HQL
- Integer subclassId = new Integer( sc.getSubclassId() );//new Integer(k+1);
+ Integer subclassId = ( sc.getSubclassId() );//(k+1);
subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() );
discriminatorValues[k] = subclassId.toString();
int id = getTableId(
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -362,7 +362,7 @@
iter = persistentClass.getSubclassPropertyClosureIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
- Integer join = new Integer( persistentClass.getJoinNumber(prop) );
+ Integer join = ( persistentClass.getJoinNumber(prop) );
propertyJoinNumbers.add(join);
//propertyTableNumbersByName.put( prop.getName(), join );
@@ -642,7 +642,7 @@
for ( int i=0; i<props.length; i++ ) {
int propTableNumber = getSubclassPropertyTableNumber( props[i], classes[i] );
if ( isSubclassTableSequentialSelect(propTableNumber) && !isSubclassTableLazy(propTableNumber) ) {
- tableNumbers.add( new Integer(propTableNumber) );
+ tableNumbers.add( (propTableNumber) );
}
}
if ( tableNumbers.isEmpty() ) return null;
@@ -651,8 +651,8 @@
ArrayList columnNumbers = new ArrayList();
final int[] columnTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassColumnClosure().length; i++ ) {
- if ( tableNumbers.contains( new Integer( columnTableNumbers[i] ) ) ) {
- columnNumbers.add( new Integer(i) );
+ if ( tableNumbers.contains( ( columnTableNumbers[i] ) ) ) {
+ columnNumbers.add( (i) );
}
}
@@ -660,8 +660,8 @@
ArrayList formulaNumbers = new ArrayList();
final int[] formulaTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassFormulaTemplateClosure().length; i++ ) {
- if ( tableNumbers.contains( new Integer( formulaTableNumbers[i] ) ) ) {
- formulaNumbers.add( new Integer(i) );
+ if ( tableNumbers.contains( ( formulaTableNumbers[i] ) ) ) {
+ formulaNumbers.add( (i) );
}
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ArrayType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ArrayType.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ArrayType.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -127,7 +127,7 @@
int length = Array.getLength(array);
for ( int i=0; i<length; i++ ) {
//TODO: proxies!
- if ( Array.get(array, i)==element ) return new Integer(i);
+ if ( Array.get(array, i)==element ) return i;
}
return null;
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ListType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ListType.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ListType.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -72,7 +72,7 @@
List list = (List) collection;
for ( int i=0; i<list.size(); i++ ) {
//TODO: proxies!
- if ( list.get(i)==element ) return new Integer(i);
+ if ( list.get(i)==element ) return i;
}
return null;
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/StringHelper.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/StringHelper.java 2012-05-17 02:54:18 UTC (rev 21029)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/StringHelper.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -352,7 +352,7 @@
inQuote = true;
}
else if ( c == character ) {
- locations.add( new Integer( indx ) );
+ locations.add(indx );
}
}
return ArrayHelper.toIntArray( locations );
Added: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/CharInNativeQueryTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/CharInNativeQueryTest.java (rev 0)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/CharInNativeQueryTest.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -0,0 +1,41 @@
+package org.hibernate.test.typedescriptor;
+
+import org.hibernate.Session;
+import org.hibernate.junit.functional.FunctionalTestCase;
+
+/**
+ * @author Strong Liu <stliu(a)hibernate.org>
+ */
+public class CharInNativeQueryTest extends FunctionalTestCase {
+ public CharInNativeQueryTest(String string) {
+ super( string );
+ }
+
+ @Override
+ public String[] getMappings() {
+ return new String[] { "typedescriptor/Issue.hbm.xml" };
+ }
+
+ public void testNativeQuery() {
+ Issue issue = new Issue();
+ issue.setIssueNumber( "HHH-2304" );
+ issue.setDescription( "Wrong type detection for sql type char(x) columns" );
+
+ Session session = openSession();
+ session.beginTransaction();
+ session.persist( issue );
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ Object issueNumber = session.createSQLQuery( "select issue.issueNumber from Issue issue" ).uniqueResult();
+ session.getTransaction().commit();
+ session.close();
+
+ assertNotNull( issueNumber );
+ assertTrue( "actual type is "+issueNumber.getClass().getName(), issueNumber instanceof String );
+ assertEquals( "HHH-2304", issueNumber );
+
+ }
+}
Added: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.hbm.xml (rev 0)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.hbm.xml 2012-05-17 05:43:28 UTC (rev 21030)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+
+<hibernate-mapping package="org.hibernate.test.typedescriptor">
+
+ <class name="Issue">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="description"/>
+ <property name="issueNumber">
+ <column name="issueNumber" sql-type="char(8)"/>
+ </property>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.java (rev 0)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/typedescriptor/Issue.java 2012-05-17 05:43:28 UTC (rev 21030)
@@ -0,0 +1,35 @@
+package org.hibernate.test.typedescriptor;
+
+/**
+ * @author Strong Liu <stliu(a)hibernate.org>
+ */
+public class Issue {
+ private Long id;
+ private String description;
+ private String issueNumber;
+
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getIssueNumber() {
+ return issueNumber;
+ }
+
+ public void setIssueNumber(String issueNumber) {
+ this.issueNumber = issueNumber;
+ }
+}
12 years, 7 months
Hibernate SVN: r21029 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2012-05-16 22:54:18 -0400 (Wed, 16 May 2012)
New Revision: 21029
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Configuration.java
Log:
JBPAPP-8682 [HHH-5043] Incorrect handling of hibernate.default_schema in SchemaUpdate
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Configuration.java 2012-04-15 10:38:33 UTC (rev 21028)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Configuration.java 2012-05-17 02:54:18 UTC (rev 21029)
@@ -991,11 +991,12 @@
while ( iter.hasNext() ) {
Table table = (Table) iter.next();
if ( table.isPhysicalTable() ) {
-
+ String tableSchema = ( table.getSchema() == null ) ? defaultSchema : table.getSchema();
+ String tableCatalog = ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog();
TableMetadata tableInfo = databaseMetadata.getTableMetadata(
table.getName(),
- ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
- ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
+ tableSchema,
+ tableCatalog,
table.isQuoted()
);
@@ -1004,8 +1005,8 @@
table.sqlCreateString(
dialect,
mapping,
- defaultCatalog,
- defaultSchema
+ tableCatalog,
+ tableSchema
)
);
}
@@ -1014,8 +1015,8 @@
dialect,
mapping,
tableInfo,
- defaultCatalog,
- defaultSchema
+ tableCatalog,
+ tableSchema
);
while ( subiter.hasNext() ) {
script.add( subiter.next() );
@@ -1034,11 +1035,12 @@
while ( iter.hasNext() ) {
Table table = (Table) iter.next();
if ( table.isPhysicalTable() ) {
-
+ String tableSchema = ( table.getSchema() == null ) ? defaultSchema : table.getSchema();
+ String tableCatalog = ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog();
TableMetadata tableInfo = databaseMetadata.getTableMetadata(
table.getName(),
- table.getSchema(),
- table.getCatalog(),
+ tableSchema,
+ tableCatalog,
table.isQuoted()
);
@@ -1059,8 +1061,8 @@
fk.sqlCreateString(
dialect,
mapping,
- defaultCatalog,
- defaultSchema
+ tableCatalog,
+ tableSchema
)
);
}
@@ -1081,8 +1083,8 @@
index.sqlCreateString(
dialect,
mapping,
- defaultCatalog,
- defaultSchema
+ tableCatalog,
+ tableSchema
)
);
}
12 years, 7 months
[hibernate/hibernate-orm] 556ca0: HHH-6054 - Support for discriminator-based multi-t...
by GitHub
Branch: refs/heads/metamodel
Home: https://github.com/hibernate/hibernate-orm
Commit: 556ca03e210b5d2c14b9414a8deb5e96526c0e53
https://github.com/hibernate/hibernate-orm/commit/556ca03e210b5d2c14b9414...
Author: root <root(a)apollo.(none)>
Date: 2012-05-15 (Tue, 15 May 2012)
Changed paths:
A hibernate-core/src/main/java/org/hibernate/annotations/MultiTenancyDiscriminatorColumn.java
A hibernate-core/src/main/java/org/hibernate/annotations/MultiTenancyDiscriminatorFormula.java
Log Message:
-----------
HHH-6054 - Support for discriminator-based multi-tenancy
Commit: 93882f49ddfaa0774ffa0800fda5e2bd487c7b21
https://github.com/hibernate/hibernate-orm/commit/93882f49ddfaa0774ffa080...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2012-05-16 (Wed, 16 May 2012)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/MultiTenancyStrategy.java
A hibernate-core/src/main/java/org/hibernate/annotations/MultiTenancy.java
R hibernate-core/src/main/java/org/hibernate/annotations/MultiTenancyDiscriminatorColumn.java
R hibernate-core/src/main/java/org/hibernate/annotations/MultiTenancyDiscriminatorFormula.java
A hibernate-core/src/main/java/org/hibernate/annotations/TenantColumn.java
A hibernate-core/src/main/java/org/hibernate/annotations/TenantFormula.java
M hibernate-core/src/main/java/org/hibernate/metamodel/Metadata.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataBuilderImpl.java
A hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/MutliTenancySourceImpl.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityClass.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/RootEntitySourceImpl.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/HibernateDotNames.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java
M hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/HierarchyDetails.java
A hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/TenantDiscrimination.java
A hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/MultiTenancySource.java
M hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/RootEntitySource.java
A hibernate-core/src/main/java/org/hibernate/service/config/spi/StandardConverters.java
M hibernate-core/src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd
M hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb
Log Message:
-----------
HHH-6054 - Support for discriminator-based multi-tenancy
Compare: https://github.com/hibernate/hibernate-orm/compare/4eb057f...93882f4
12 years, 7 months