[hibernate-commits] Hibernate SVN: r20741 - in core/trunk: core/src/main/java/org/hibernate/cfg/annotations and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Sep 28 12:32:28 EDT 2010


Author: hardy.ferentschik
Date: 2010-09-28 12:32:26 -0400 (Tue, 28 Sep 2010)
New Revision: 20741

Added:
   core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/OptimisticLockAnnotationTest.java
Removed:
   core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/VersionTest.java
Modified:
   core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java
   core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java
   core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
   core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
   core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java
   core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java
   core/trunk/core/src/main/java/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
   core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
Log:
HHH-5205 - Renamed BinderHelper.isDefault() to BinderHelper.isEmptyAnnotationValue() , because this describes better what the function does. Also renamed VersionTest to OptimisitcLockAnnotationTest to better describe what gets tested.

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -499,7 +499,7 @@
 		// YUCK!  but cannot think of a clean way to do this given the string-config based scheme
 		params.put( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, mappings.getObjectNameNormalizer() );
 
-		if ( !isDefault( generatorName ) ) {
+		if ( !isEmptyAnnotationValue( generatorName ) ) {
 			//we have a named generator
 			IdGenerator gen = mappings.getGenerator( generatorName, localGenerators );
 			if ( gen == null ) {
@@ -526,7 +526,7 @@
 		id.setIdentifierGeneratorProperties( params );
 	}
 
-	public static boolean isDefault(String annotationString) {
+	public static boolean isEmptyAnnotationValue(String annotationString) {
 		return annotationString != null && annotationString.length() == 0;
 		//equivalent to (but faster) ANNOTATION_STRING_DEFAULT.equals( annotationString );
 	}
@@ -628,7 +628,7 @@
 	}
 
 	private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) {
-		if ( mustHaveName && isDefault( defAnn.name() ) ) {
+		if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) {
 			String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ?
 					( (XClass) annotatedElement ).getName() :
 					( (XPackage) annotatedElement ).getName();
@@ -637,7 +637,7 @@
 	}
 
 	private static void bindAnyMetaDef(AnyMetaDef defAnn, Mappings mappings) {
-		if ( isDefault( defAnn.name() ) ) return; //don't map not named definitions
+		if ( isEmptyAnnotationValue( defAnn.name() ) ) return; //don't map not named definitions
 		log.info( "Binding Any Meta definition: {}", defAnn.name() );
 		mappings.addAnyMetaDef( defAnn );
 	}


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -78,7 +78,7 @@
 		Map<String, Ejb3JoinColumn> columnByReferencedName = new HashMap<String, Ejb3JoinColumn>(joinColumns.length);
 		for (Ejb3JoinColumn joinColumn : joinColumns) {
 			final String referencedColumnName = joinColumn.getReferencedColumn();
-			if ( referencedColumnName == null || BinderHelper.isDefault( referencedColumnName ) ) {
+			if ( referencedColumnName == null || BinderHelper.isEmptyAnnotationValue( referencedColumnName ) ) {
 				break;
 			}
 			//JPA 2 requires referencedColumnNames to be case insensitive


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -71,12 +71,12 @@
 		}
 		else if ( discAnn != null ) {
 			discriminatorColumn.setImplicit( false );
-			if ( !BinderHelper.isDefault( discAnn.columnDefinition() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( discAnn.columnDefinition() ) ) {
 				discriminatorColumn.setSqlType(
 						discAnn.columnDefinition()
 				);
 			}
-			if ( !BinderHelper.isDefault( discAnn.name() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( discAnn.name() ) ) {
 				discriminatorColumn.setLogicalColumnName( discAnn.name() );
 			}
 			discriminatorColumn.setNullable( false );


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -249,7 +249,7 @@
 			String suffixForDefaultColumnName,
 			Mappings mappings) {
 		if ( ann != null ) {
-			if ( BinderHelper.isDefault( mappedBy ) ) {
+			if ( BinderHelper.isEmptyAnnotationValue( mappedBy ) ) {
 				throw new AnnotationException(
 						"Illegal attempt to define a @JoinColumn with a mappedBy association: "
 								+ BinderHelper.getRelativePath( propertyHolder, propertyName )
@@ -299,8 +299,8 @@
 		}
 		else {
 			setImplicit( false );
-			if ( !BinderHelper.isDefault( annJoin.columnDefinition() ) ) setSqlType( annJoin.columnDefinition() );
-			if ( !BinderHelper.isDefault( annJoin.name() ) ) setLogicalColumnName( annJoin.name() );
+			if ( !BinderHelper.isEmptyAnnotationValue( annJoin.columnDefinition() ) ) setSqlType( annJoin.columnDefinition() );
+			if ( !BinderHelper.isEmptyAnnotationValue( annJoin.name() ) ) setLogicalColumnName( annJoin.name() );
 			setNullable( annJoin.nullable() );
 			setUnique( annJoin.unique() );
 			setInsertable( annJoin.insertable() );


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -88,8 +88,8 @@
 			Mappings mappings) {
 		IndexColumn column;
 		if ( ann != null ) {
-			String sqlType = BinderHelper.isDefault( ann.columnDefinition() ) ? null : ann.columnDefinition();
-			String name = BinderHelper.isDefault( ann.name() ) ? inferredData.getPropertyName() + "_ORDER" : ann.name();
+			String sqlType = BinderHelper.isEmptyAnnotationValue( ann.columnDefinition() ) ? null : ann.columnDefinition();
+			String name = BinderHelper.isEmptyAnnotationValue( ann.name() ) ? inferredData.getPropertyName() + "_ORDER" : ann.name();
 			//TODO move it to a getter based system and remove the constructor
 // The JPA OrderColumn annotation defines no table element...
 //			column = new IndexColumn(
@@ -120,8 +120,8 @@
 			Mappings mappings) {
 		IndexColumn column;
 		if ( ann != null ) {
-			String sqlType = BinderHelper.isDefault( ann.columnDefinition() ) ? null : ann.columnDefinition();
-			String name = BinderHelper.isDefault( ann.name() ) ? inferredData.getPropertyName() : ann.name();
+			String sqlType = BinderHelper.isEmptyAnnotationValue( ann.columnDefinition() ) ? null : ann.columnDefinition();
+			String name = BinderHelper.isEmptyAnnotationValue( ann.name() ) ? inferredData.getPropertyName() : ann.name();
 			//TODO move it to a getter based system and remove the constructor
 			column = new IndexColumn(
 					false, sqlType, 0, 0, 0, name, ann.nullable(),


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -114,7 +114,7 @@
 		binder.setCascade( cascadeStrategy );
 		binder.setAccessType( inferredData.getDefaultAccess() );
 		Property prop = binder.makeProperty();
-		if ( BinderHelper.isDefault( mappedBy ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( mappedBy ) ) {
 			/*
 			 * we need to check if the columns are in the right order
 			 * if not, then we need to create a many to one and formula
@@ -236,7 +236,7 @@
 		}
 		ForeignKey fk = inferredData.getProperty().getAnnotation( ForeignKey.class );
 		String fkName = fk != null ? fk.name() : "";
-		if ( !BinderHelper.isDefault( fkName ) ) value.setForeignKeyName( fkName );
+		if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) value.setForeignKeyName( fkName );
 	}
 
 	/**


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -24,12 +24,12 @@
 package org.hibernate.cfg;
 
 import java.util.Map;
+
 import org.hibernate.MappingException;
 import org.hibernate.cfg.annotations.SimpleValueBinder;
 
 /**
  * @author Sharath Reddy
- *
  */
 public class SetSimpleValueTypeSecondPass implements SecondPass {
 
@@ -38,9 +38,8 @@
 	public SetSimpleValueTypeSecondPass(SimpleValueBinder val) {
 		binder = val;
 	}
-	
+
 	public void doSecondPass(Map persistentClasses) throws MappingException {
 		binder.fillSimpleValue();
 	}
-
 }


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -224,7 +224,7 @@
 
 	public void setSqlOrderBy(OrderBy orderByAnn) {
 		if ( orderByAnn != null ) {
-			if ( !BinderHelper.isDefault( orderByAnn.clause() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( orderByAnn.clause() ) ) {
 				orderBy = orderByAnn.clause();
 			}
 		}
@@ -471,7 +471,7 @@
 		}
 
 		//work on association
-		boolean isMappedBy = !BinderHelper.isDefault( mappedBy );
+		boolean isMappedBy = !BinderHelper.isEmptyAnnotationValue( mappedBy );
 
 		if (isMappedBy
 				&& (property.isAnnotationPresent( JoinColumn.class )
@@ -672,7 +672,7 @@
 				&& !reversePropertyInJoin
 				&& oneToMany
 				&& !this.isExplicitAssociationTable
-				&& ( joinColumns[0].isImplicit() && !BinderHelper.isDefault( this.mappedBy ) //implicit @JoinColumn
+				&& ( joinColumns[0].isImplicit() && !BinderHelper.isEmptyAnnotationValue( this.mappedBy ) //implicit @JoinColumn
 				|| !fkJoinColumns[0].isImplicit() ) //this is an explicit @JoinColumn
 				) {
 			//this is a Foreign key
@@ -865,7 +865,7 @@
 	}
 
 	private String getCondition(String cond, String name) {
-		if ( BinderHelper.isDefault( cond ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( cond ) ) {
 			cond = mappings.getFilterDefinition( name ).getDefaultFilterCondition();
 			if ( StringHelper.isEmpty( cond ) ) {
 				throw new AnnotationException(
@@ -879,7 +879,7 @@
 
 	public void setCache(Cache cacheAnn) {
 		if ( cacheAnn != null ) {
-			cacheRegionName = BinderHelper.isDefault( cacheAnn.region() ) ? null : cacheAnn.region();
+			cacheRegionName = BinderHelper.isEmptyAnnotationValue( cacheAnn.region() ) ? null : cacheAnn.region();
 			cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cacheAnn.usage() );
 		}
 		else {
@@ -1123,7 +1123,7 @@
 		collValue.setKey( key );
 		ForeignKey fk = property != null ? property.getAnnotation( ForeignKey.class ) : null;
 		String fkName = fk != null ? fk.name() : "";
-		if ( !BinderHelper.isDefault( fkName ) ) key.setForeignKeyName( fkName );
+		if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) key.setForeignKeyName( fkName );
 		return key;
 	}
 
@@ -1188,7 +1188,7 @@
 			}
 		}
 
-		boolean mappedBy = !BinderHelper.isDefault( joinColumns[0].getMappedBy() );
+		boolean mappedBy = !BinderHelper.isEmptyAnnotationValue( joinColumns[0].getMappedBy() );
 		if ( mappedBy ) {
 			if ( !isCollectionOfEntities ) {
 				StringBuilder error = new StringBuilder( 80 )
@@ -1281,7 +1281,7 @@
 			}
 			ForeignKey fk = property != null ? property.getAnnotation( ForeignKey.class ) : null;
 			String fkName = fk != null ? fk.inverseName() : "";
-			if ( !BinderHelper.isDefault( fkName ) ) element.setForeignKeyName( fkName );
+			if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) element.setForeignKeyName( fkName );
 		}
 		else if ( anyAnn != null ) {
 			//@ManyToAny


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -170,7 +170,7 @@
 
 	private void bindEjb3Annotation(Entity ejb3Ann) {
 		if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" );
-		if ( BinderHelper.isDefault( ejb3Ann.name() ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( ejb3Ann.name() ) ) {
 			name = StringHelper.unqualify( annotatedClass.getName() );
 		}
 		else {
@@ -243,7 +243,7 @@
 		}
 		else {
 			org.hibernate.annotations.Entity entityAnn = annotatedClass.getAnnotation( org.hibernate.annotations.Entity.class );
-			if ( entityAnn != null && !BinderHelper.isDefault( entityAnn.persister() ) ) {
+			if ( entityAnn != null && !BinderHelper.isEmptyAnnotationValue( entityAnn.persister() ) ) {
 				try {
 					persister = ReflectHelper.classForName( entityAnn.persister() );
 				}
@@ -319,7 +319,7 @@
 			for ( Map.Entry<String, String> filter : filters.entrySet() ) {
 				String filterName = filter.getKey();
 				String cond = filter.getValue();
-				if ( BinderHelper.isDefault( cond ) ) {
+				if ( BinderHelper.isEmptyAnnotationValue( cond ) ) {
 					FilterDefinition definition = mappings.getFilterDefinition( filterName );
 					cond = definition == null ? null : definition.getDefaultFilterCondition();
 					if ( StringHelper.isEmpty( cond ) ) {
@@ -606,7 +606,7 @@
 
 	private void setFKNameIfDefined(Join join) {
 		org.hibernate.annotations.Table matchingTable = findMatchingComplimentTableAnnotation( join );
-		if ( matchingTable != null && !BinderHelper.isDefault( matchingTable.foreignKey().name() ) ) {
+		if ( matchingTable != null && !BinderHelper.isEmptyAnnotationValue( matchingTable.foreignKey().name() ) ) {
 			( (SimpleValue) join.getKey() ).setForeignKeyName( matchingTable.foreignKey().name() );
 		}
 	}
@@ -740,19 +740,19 @@
 			join.setSequentialSelect( FetchMode.JOIN != matchingTable.fetch() );
 			join.setInverse( matchingTable.inverse() );
 			join.setOptional( matchingTable.optional() );
-			if ( !BinderHelper.isDefault( matchingTable.sqlInsert().sql() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( matchingTable.sqlInsert().sql() ) ) {
 				join.setCustomSQLInsert( matchingTable.sqlInsert().sql().trim(),
 						matchingTable.sqlInsert().callable(),
 						ExecuteUpdateResultCheckStyle.parse( matchingTable.sqlInsert().check().toString().toLowerCase() )
 				);
 			}
-			if ( !BinderHelper.isDefault( matchingTable.sqlUpdate().sql() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( matchingTable.sqlUpdate().sql() ) ) {
 				join.setCustomSQLUpdate( matchingTable.sqlUpdate().sql().trim(),
 						matchingTable.sqlUpdate().callable(),
 						ExecuteUpdateResultCheckStyle.parse( matchingTable.sqlUpdate().check().toString().toLowerCase() )
 				);
 			}
-			if ( !BinderHelper.isDefault( matchingTable.sqlDelete().sql() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( matchingTable.sqlDelete().sql() ) ) {
 				join.setCustomSQLDelete( matchingTable.sqlDelete().sql().trim(),
 						matchingTable.sqlDelete().callable(),
 						ExecuteUpdateResultCheckStyle.parse( matchingTable.sqlDelete().check().toString().toLowerCase() )
@@ -782,7 +782,7 @@
 
 	public void setCache(Cache cacheAnn) {
 		if ( cacheAnn != null ) {
-			cacheRegion = BinderHelper.isDefault( cacheAnn.region() ) ?
+			cacheRegion = BinderHelper.isEmptyAnnotationValue( cacheAnn.region() ) ?
 					null :
 					cacheAnn.region();
 			cacheConcurrentStrategy = getCacheConcurrencyStrategy( cacheAnn.usage() );
@@ -853,7 +853,7 @@
 					"@org.hibernate.annotations.Table references an unknown table: " + appliedTable
 			);
 		}
-		if ( !BinderHelper.isDefault( table.comment() ) ) hibTable.setComment( table.comment() );
+		if ( !BinderHelper.isEmptyAnnotationValue( table.comment() ) ) hibTable.setComment( table.comment() );
 		TableBinder.addIndexes( hibTable, table.indexes(), mappings );
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -101,7 +101,7 @@
 			simpleValue.setTable( table );
 			simpleValue.setColumns( idColumns );
 			Type typeAnn = collectionIdAnn.type();
-			if ( typeAnn != null && !BinderHelper.isDefault( typeAnn.type() ) ) {
+			if ( typeAnn != null && !BinderHelper.isEmptyAnnotationValue( typeAnn.type() ) ) {
 				simpleValue.setExplicitType( typeAnn );
 			}
 			else {

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -285,12 +285,12 @@
 					//the algorithm generally does not apply for map key anyway
 					MapKey mapKeyAnn = property.getAnnotation( org.hibernate.annotations.MapKey.class );
 					elementBinder.setKey(true);
-					if (mapKeyAnn != null && ! BinderHelper.isDefault( mapKeyAnn.type().type() ) ) {
+					if (mapKeyAnn != null && ! BinderHelper.isEmptyAnnotationValue( mapKeyAnn.type().type() ) ) {
 						elementBinder.setExplicitType( mapKeyAnn.type() );
 					}
 					else {
 						MapKeyType mapKeyTypeAnnotation = property.getAnnotation( MapKeyType.class );
-						if ( mapKeyTypeAnnotation != null && ! BinderHelper.isDefault( mapKeyTypeAnnotation.value().type() ) ) {
+						if ( mapKeyTypeAnnotation != null && ! BinderHelper.isEmptyAnnotationValue( mapKeyTypeAnnotation.value().type() ) ) {
 							elementBinder.setExplicitType( mapKeyTypeAnnotation.value() );
 						}
 						else {


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -59,7 +59,7 @@
 
 	public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isDefault) {
 		if ( queryAnn == null ) return;
-		if ( BinderHelper.isDefault( queryAnn.name() ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
 			throw new AnnotationException( "A named query must have a name when used in class or package level" );
 		}
 		//EJBQL Query
@@ -90,14 +90,14 @@
 	public static void bindNativeQuery(NamedNativeQuery queryAnn, Mappings mappings, boolean isDefault) {
 		if ( queryAnn == null ) return;
 		//ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
-		if ( BinderHelper.isDefault( queryAnn.name() ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
 			throw new AnnotationException( "A named query must have a name when used in class or package level" );
 		}
 		NamedSQLQueryDefinition query;
 		String resultSetMapping = queryAnn.resultSetMapping();
 		QueryHint[] hints = queryAnn.hints();
 		String queryName = queryAnn.query();
-		if ( !BinderHelper.isDefault( resultSetMapping ) ) {
+		if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
 			//sql result set usage
 			query = new NamedSQLQueryDefinition(
 					queryName,
@@ -151,25 +151,25 @@
 	public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, Mappings mappings) {
 		if ( queryAnn == null ) return;
 		//ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
-		if ( BinderHelper.isDefault( queryAnn.name() ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
 			throw new AnnotationException( "A named query must have a name when used in class or package level" );
 		}
 		NamedSQLQueryDefinition query;
 		String resultSetMapping = queryAnn.resultSetMapping();
-		if ( !BinderHelper.isDefault( resultSetMapping ) ) {
+		if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
 			//sql result set usage
 			query = new NamedSQLQueryDefinition(
 					queryAnn.query(),
 					resultSetMapping,
 					null,
 					queryAnn.cacheable(),
-					BinderHelper.isDefault( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
+					BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
 					queryAnn.timeout() < 0 ? null : queryAnn.timeout(),
 					queryAnn.fetchSize() < 0 ? null : queryAnn.fetchSize(),
 					getFlushMode( queryAnn.flushMode() ),
 					getCacheMode( queryAnn.cacheMode() ),
 					queryAnn.readOnly(),
-					BinderHelper.isDefault( queryAnn.comment() ) ? null : queryAnn.comment(),
+					BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment(),
 					null,
 					queryAnn.callable()
 			);
@@ -184,13 +184,13 @@
 					new NativeSQLQueryReturn[] { entityQueryReturn },
 					null,
 					queryAnn.cacheable(),
-					BinderHelper.isDefault( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
+					BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
 					queryAnn.timeout() < 0 ? null : queryAnn.timeout(),
 					queryAnn.fetchSize() < 0 ? null : queryAnn.fetchSize(),
 					getFlushMode( queryAnn.flushMode() ),
 					getCacheMode( queryAnn.cacheMode() ),
 					queryAnn.readOnly(),
-					BinderHelper.isDefault( queryAnn.comment() ) ? null : queryAnn.comment(),
+					BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment(),
 					null,
 					queryAnn.callable()
 			);
@@ -227,7 +227,7 @@
 
 	public static void bindQuery(org.hibernate.annotations.NamedQuery queryAnn, Mappings mappings) {
 		if ( queryAnn == null ) return;
-		if ( BinderHelper.isDefault( queryAnn.name() ) ) {
+		if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
 			throw new AnnotationException( "A named query must have a name when used in class or package level" );
 		}
 
@@ -237,13 +237,13 @@
 		NamedQueryDefinition query = new NamedQueryDefinition(
 				queryAnn.query(),
 				queryAnn.cacheable(),
-				BinderHelper.isDefault( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
+				BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion(),
 				queryAnn.timeout() < 0 ? null : queryAnn.timeout(),
 				queryAnn.fetchSize() < 0 ? null : queryAnn.fetchSize(),
 				flushMode,
 				getCacheMode( queryAnn.cacheMode() ),
 				queryAnn.readOnly(),
-				BinderHelper.isDefault( queryAnn.comment() ) ? null : queryAnn.comment(),
+				BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment(),
 				null
 		);
 


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -157,7 +157,7 @@
 				);
 			}
 
-			if ( !BinderHelper.isDefault( entity.discriminatorColumn() ) ) {
+			if ( !BinderHelper.isEmptyAnnotationValue( entity.discriminatorColumn() ) ) {
 				final String quotingNormalizedName = mappings.getObjectNameNormalizer().normalizeIdentifierQuoting(
 						entity.discriminatorColumn()
 				);


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -213,8 +213,8 @@
 			Table denormalizedSuperTable,
 			Mappings mappings,
 			String subselect) {
-		schema = BinderHelper.isDefault( schema ) ? mappings.getSchemaName() : schema;
-		catalog = BinderHelper.isDefault( catalog ) ? mappings.getCatalogName() : catalog;
+		schema = BinderHelper.isEmptyAnnotationValue( schema ) ? mappings.getSchemaName() : schema;
+		catalog = BinderHelper.isEmptyAnnotationValue( catalog ) ? mappings.getCatalogName() : catalog;
 
 		String realTableName = mappings.getObjectNameNormalizer().normalizeDatabaseIdentifier(
 				nameSource.getExplicitName(),
@@ -282,8 +282,8 @@
 			String constraints,
 			Table denormalizedSuperTable,
 			Mappings mappings) {
-		schema = BinderHelper.isDefault( schema ) ? mappings.getSchemaName() : schema;
-		catalog = BinderHelper.isDefault( catalog ) ? mappings.getCatalogName() : catalog;
+		schema = BinderHelper.isEmptyAnnotationValue( schema ) ? mappings.getSchemaName() : schema;
+		catalog = BinderHelper.isEmptyAnnotationValue( catalog ) ? mappings.getCatalogName() : catalog;
 		Table table;
 		if ( denormalizedSuperTable != null ) {
 			table = mappings.addDenormalizedTable(


Property changes on: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Copied: core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/OptimisticLockAnnotationTest.java (from rev 20735, core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/VersionTest.java)
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/OptimisticLockAnnotationTest.java	                        (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/OptimisticLockAnnotationTest.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+
+//$Id$
+package org.hibernate.test.annotations.various;
+
+import org.hibernate.Session;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * Test for the @OptimisticLock annotation.
+ *
+ * @author Emmanuel Bernard
+ */
+public class OptimisticLockAnnotationTest extends TestCase {
+
+	public void testOptimisticLockExcludeOnNameProperty() throws Exception {
+		Conductor c = new Conductor();
+		c.setName( "Bob" );
+		Session s = openSession();
+		s.getTransaction().begin();
+		s.persist( c );
+		s.flush();
+
+		s.clear();
+
+		c = ( Conductor ) s.get( Conductor.class, c.getId() );
+		Long version = c.getVersion();
+		c.setName( "Don" );
+		s.flush();
+
+		s.clear();
+
+		c = ( Conductor ) s.get( Conductor.class, c.getId() );
+		assertEquals( version, c.getVersion() );
+
+		s.getTransaction().rollback();
+		s.close();
+	}
+
+	protected Class[] getAnnotatedClasses() {
+		return new Class[] {
+				Conductor.class
+		};
+	}
+}


Property changes on: core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/OptimisticLockAnnotationTest.java
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/VersionTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/VersionTest.java	2010-09-28 16:28:30 UTC (rev 20740)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/various/VersionTest.java	2010-09-28 16:32:26 UTC (rev 20741)
@@ -1,41 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.various;
-
-import org.hibernate.Session;
-import org.hibernate.test.annotations.TestCase;
-
-/**
- * @author Emmanuel Bernard
- */
-public class VersionTest extends TestCase {
-
-	public void testOptimisticLockDisabled() throws Exception {
-		Conductor c = new Conductor();
-		c.setName( "Bob" );
-		Session s = openSession( );
-		s.getTransaction().begin();
-		s.persist( c );
-		s.flush();
-
-		s.clear();
-
-		c = (Conductor) s.get( Conductor.class, c.getId() );
-		Long version = c.getVersion();
-		c.setName( "Don" );
-		s.flush();
-
-		s.clear();
-
-		c = (Conductor) s.get( Conductor.class, c.getId() );
-		assertEquals( version, c.getVersion() );
-
-		s.getTransaction().rollback();
-		s.close();
-	}
-
-	protected Class[] getAnnotatedClasses() {
-		return new Class[] {
-				Conductor.class
-		};
-	}
-}



More information about the hibernate-commits mailing list