Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7473/metadata/src/java/org/hibernate/cfg/annotations
Modified Files:
CollectionBinder.java ListBinder.java
Log Message:
ANN-240 complete rework to embed overriding mechanism inside property holder
Index: CollectionBinder.java
===================================================================
RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- CollectionBinder.java 13 Feb 2006 19:14:35 -0000 1.33
+++ CollectionBinder.java 14 Feb 2006 18:40:31 -0000 1.34
@@ -10,6 +10,8 @@
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.MapKey;
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -775,13 +777,11 @@
else {
XClass elementClass;
AnnotatedClassType classType;
- PropertyHolder holder = PropertyHolderBuilder.buildPropertyHolder(
- collValue,
- collValue.getRole()
- );
- Map<String, javax.persistence.Column[]> columnOverrides = PropertyHolderBuilder.buildColumnOverride(
- property, StringHelper.qualify( holder.getPath(), "element" )
- );
+// Map<String, javax.persistence.Column[]> columnOverrides = PropertyHolderBuilder.buildColumnOverride(
+// property, StringHelper.qualify( collValue.getRole(), "element" )
+// );
+ //FIXME the "element" is lost
+ PropertyHolder holder = null;
if ( BinderHelper.PRIMITIVE_NAMES.contains( collType ) ) {
classType = AnnotatedClassType.NONE;
elementClass = null;
@@ -794,8 +794,17 @@
throw new AnnotationException( "Unable to find class: " + collType, e );
}
classType = mappings.getClassType( elementClass );
+
+ holder = PropertyHolderBuilder.buildPropertyHolder(
+ collValue,
+ collValue.getRole(),
+ elementClass,
+ property
+ );
//force in case of attribute override
- if ( isEmbedded || ( columnOverrides != null && ! columnOverrides.isEmpty() ) ) {
+ boolean attributeOverride = property.isAnnotationPresent(AttributeOverride.class)
+ || property.isAnnotationPresent( AttributeOverrides.class);
+ if ( isEmbedded || attributeOverride ) {
classType = AnnotatedClassType.EMBEDDABLE;
}
}
@@ -825,7 +834,7 @@
Component component = AnnotationBinder.fillComponent(
holder, inferredData, isPropertyAnnotated, isPropertyAnnotated ? "property" : "field", true,
entityBinder, false,
- columnOverrides, mappings, false
+ mappings, false
);
collValue.setElement( component );
}
Index: ListBinder.java
===================================================================
RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ListBinder.java 25 Jan 2006 21:48:20 -0000 1.22
+++ ListBinder.java 14 Feb 2006 18:40:31 -0000 1.23
@@ -24,6 +24,7 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.reflection.XProperty;
+import org.hibernate.reflection.XClass;
/**
* Bind a list
@@ -75,7 +76,9 @@
if ( indexColumn.isImplicit() == false ) {
PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder(
this.collection,
- IndexedCollection.DEFAULT_INDEX_COLUMN_NAME
+ IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
+ (XClass) null,
+ (XProperty) null
);
List list = (List) this.collection;
if ( ! list.isOneToMany() ) indexColumn.forceNotNull();
|