diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverridenAnnotationReader.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverridenAnnotationReader.java index 81fd0727ae..cd2354b6b5 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverridenAnnotationReader.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverridenAnnotationReader.java @@ -31,9 +31,11 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -396,8 +398,6 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { getElementCollection( annotationList, defaults ); addIfNotNull( annotationList, getSequenceGenerator( elementsForProperty, defaults ) ); addIfNotNull( annotationList, getTableGenerator( elementsForProperty, defaults ) ); - addIfNotNull( annotationList, getAttributeOverrides( elementsForProperty, defaults ) ); - } processEventAnnotations( annotationList, defaults ); //FIXME use annotationsMap rather than annotationList this will be faster since the annotation type is usually known at put() time @@ -634,31 +634,36 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { } } + private void getJoinTable(List annotationList, Element tree, XMLContext.Default defaults) { + addIfNotNull( annotationList, buildJoinTable( tree, defaults ) ); + } + /* * no partial overriding possible */ - private void getJoinTable(List annotationList, Element tree, XMLContext.Default defaults) { + private JoinTable buildJoinTable(Element tree, XMLContext.Default defaults) { Element subelement = tree == null ? null : tree.element( "join-table" ); final Class annotationType = JoinTable.class; - if ( subelement != null ) { - //ignore java annotation, an element is defined - AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType ); - copyStringAttribute( annotation, subelement, "name", false ); - copyStringAttribute( annotation, subelement, "catalog", false ); - if ( StringHelper.isNotEmpty( defaults.getCatalog() ) - && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) { - annotation.setValue( "catalog", defaults.getCatalog() ); - } - copyStringAttribute( annotation, subelement, "schema", false ); - if ( StringHelper.isNotEmpty( defaults.getSchema() ) - && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { - annotation.setValue( "schema", defaults.getSchema() ); - } - buildUniqueConstraints( annotation, subelement ); - annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) ); - annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) ); - annotationList.add( AnnotationFactory.create( annotation ) ); + if ( subelement == null ) { + return null; } + //ignore java annotation, an element is defined + AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType ); + copyStringAttribute( annotation, subelement, "name", false ); + copyStringAttribute( annotation, subelement, "catalog", false ); + if ( StringHelper.isNotEmpty( defaults.getCatalog() ) + && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) { + annotation.setValue( "catalog", defaults.getCatalog() ); + } + copyStringAttribute( annotation, subelement, "schema", false ); + if ( StringHelper.isNotEmpty( defaults.getSchema() ) + && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { + annotation.setValue( "schema", defaults.getSchema() ); + } + buildUniqueConstraints( annotation, subelement ); + annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) ); + annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) ); + return AnnotationFactory.create( annotation ); } private void getAssociation( @@ -853,7 +858,7 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { return joinColumns.toArray( new MapKeyJoinColumn[joinColumns.size()] ); } - private Annotation getMapKeyAttributeOverrides(Element tree, Default defaults) { + private AttributeOverrides getMapKeyAttributeOverrides(Element tree, Default defaults) { List attributes = buildMapKeyAttributeOverrides( tree ); return mergeAttributeOverrides( defaults, attributes ); } @@ -891,7 +896,6 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { ad.setValue( "value", value ); annotationList.add( AnnotationFactory.create( ad ) ); } - } /** @@ -972,7 +976,6 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { } } - //TODO: Complete parsing of all element-collection related xml private void getElementCollection(List annotationList, XMLContext.Default defaults) { for ( Element element : elementsForProperty ) { if ( "element-collection".equals( element.getName() ) ) { @@ -980,20 +983,21 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { addTargetClass( element, ad, "target-class", defaults ); getFetchType( ad, element ); getOrderBy( annotationList, element ); - //TODO: support order-column + getOrderColumn( annotationList, element ); getMapKey( annotationList, element ); getMapKeyClass( annotationList, element, defaults ); - //TODO: support map-key-temporal - //TODO: support map-key-enumerated - //TODO: support map-key-attribute-override + getMapKeyTemporal( annotationList, element ); + getMapKeyEnumerated( annotationList, element ); getMapKeyColumn( annotationList, element ); - //TODO: support map-key-join-column + buildMapKeyJoinColumns( annotationList, element ); Annotation annotation = getColumn( element.element( "column" ), false, element ); addIfNotNull( annotationList, annotation ); getTemporal( annotationList, element ); getEnumerated( annotationList, element ); getLob( annotationList, element ); - annotation = getAttributeOverrides( element, defaults ); + AttributeOverrides mapKeyAttributeOverridesAnno = getMapKeyAttributeOverrides( element, defaults ); + AttributeOverrides attributeOverridesAnno = getAttributeOverrides( element, defaults ); + annotation = mergeAttributeOverridesAnnotations( mapKeyAttributeOverridesAnno, attributeOverridesAnno ); addIfNotNull( annotationList, annotation ); annotation = getAssociationOverrides( element, defaults ); addIfNotNull( annotationList, annotation ); @@ -1004,6 +1008,23 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { } } + private AttributeOverrides mergeAttributeOverridesAnnotations(AttributeOverrides overrides1, AttributeOverrides overrides2) { + //If either one is null, no need to merge, so just return + if(overrides1 == null) { + return overrides2; + } + if(overrides2 == null) { + return overrides1; + } + //Neither one is null + List attributes = new LinkedList(); + attributes.addAll( Arrays.asList( overrides1.value() ) ); + attributes.addAll( Arrays.asList( overrides2.value() ) ); + AnnotationDescriptor ad = new AnnotationDescriptor( AttributeOverrides.class ); + ad.setValue( "value", attributes.toArray( new AttributeOverride[attributes.size()] ) ); + return AnnotationFactory.create( ad ); + } + private void getOrderBy(List annotationList, Element element) { Element subelement = element != null ? element.element( "order-by" ) : null; if ( subelement != null ) { @@ -1482,7 +1503,7 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { } private AssociationOverrides getAssociationOverrides(Element tree, XMLContext.Default defaults) { - List attributes = buildAssociationOverrides( tree ); + List attributes = buildAssociationOverrides( tree, defaults ); if ( defaults.canUseJavaAnnotations() ) { AssociationOverride annotation = getJavaAnnotation( AssociationOverride.class ); addAssociationOverrideIfNeeded( annotation, attributes ); @@ -1503,7 +1524,7 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { } } - private List buildAssociationOverrides(Element element) { + private List buildAssociationOverrides(Element element, XMLContext.Default defaults ) { List subelements = element == null ? null : element.elements( "association-override" ); List overrides = new ArrayList(); if ( subelements != null && subelements.size() > 0 ) { @@ -1511,6 +1532,10 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class ); copyStringAttribute( override, current, "name", true ); override.setValue( "joinColumns", getJoinColumns( current, false ) ); + JoinTable joinTable = buildJoinTable( current, defaults ); + if ( joinTable != null ) { + override.setValue( "joinTable", joinTable ); + } overrides.add( (AssociationOverride) AnnotationFactory.create( override ) ); } } @@ -2347,6 +2372,7 @@ public class JPAOverridenAnnotationReader implements AnnotationReader { columnNames[columnNameIndex++] = columnNameElt.getTextTrim(); } AnnotationDescriptor ucAnn = new AnnotationDescriptor( UniqueConstraint.class ); + ucAnn.setValue( "name", subelement.attributeValue( "name", "" ) ); ucAnn.setValue( "columnNames", columnNames ); uniqueConstraints[ucIndex++] = AnnotationFactory.create( ucAnn ); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlElementCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlElementCollectionTest.java new file mode 100644 index 0000000000..a254f04656 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlElementCollectionTest.java @@ -0,0 +1,674 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @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 + */ + +package org.hibernate.test.annotations.xml.ejb3; + +import javax.persistence.Access; +import javax.persistence.AccessType; +import javax.persistence.AssociationOverride; +import javax.persistence.AssociationOverrides; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.Lob; +import javax.persistence.MapKey; +import javax.persistence.MapKeyClass; +import javax.persistence.MapKeyColumn; +import javax.persistence.MapKeyEnumerated; +import javax.persistence.MapKeyJoinColumn; +import javax.persistence.MapKeyJoinColumns; +import javax.persistence.MapKeyTemporal; +import javax.persistence.OrderBy; +import javax.persistence.OrderColumn; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.UniqueConstraint; + +public class Ejb3XmlElementCollectionTest extends Ejb3XmlTestCase { + + public void testNoChildren() throws Exception { + reader = getReader( Entity2.class, "field1", "element-collection.orm1.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( OrderBy.class ); + assertAnnotationNotPresent( OrderColumn.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertAnnotationNotPresent( Column.class ); + assertAnnotationNotPresent( Temporal.class ); + assertAnnotationNotPresent( Enumerated.class ); + assertAnnotationNotPresent( Lob.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationNotPresent( AttributeOverrides.class ); + assertAnnotationNotPresent( AssociationOverride.class ); + assertAnnotationNotPresent( AssociationOverrides.class ); + assertAnnotationNotPresent( CollectionTable.class ); + assertAnnotationNotPresent( Access.class ); + ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); + assertEquals( FetchType.LAZY, relAnno.fetch() ); + assertEquals( void.class, relAnno.targetClass() ); + } + + public void testOrderBy() throws Exception { + reader = getReader( Entity2.class, "field1", "element-collection.orm2.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( OrderBy.class ); + assertAnnotationNotPresent( OrderColumn.class ); + assertEquals( "col1 ASC, col2 DESC", reader.getAnnotation( OrderBy.class ) + .value() ); + } + + public void testOrderColumnNoAttributes() throws Exception { + reader = getReader( Entity2.class, "field1", "element-collection.orm3.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( OrderBy.class ); + assertAnnotationPresent( OrderColumn.class ); + OrderColumn orderColumnAnno = reader.getAnnotation( OrderColumn.class ); + assertEquals( "", orderColumnAnno.columnDefinition() ); + assertEquals( "", orderColumnAnno.name() ); + assertTrue( orderColumnAnno.insertable() ); + assertTrue( orderColumnAnno.nullable() ); + assertTrue( orderColumnAnno.updatable() ); + } + + public void testOrderColumnAllAttributes() throws Exception { + reader = getReader( Entity2.class, "field1", "element-collection.orm4.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( OrderBy.class ); + assertAnnotationPresent( OrderColumn.class ); + OrderColumn orderColumnAnno = reader.getAnnotation( OrderColumn.class ); + assertEquals( "int", orderColumnAnno.columnDefinition() ); + assertEquals( "col1", orderColumnAnno.name() ); + assertFalse( orderColumnAnno.insertable() ); + assertFalse( orderColumnAnno.nullable() ); + assertFalse( orderColumnAnno.updatable() ); + } + + public void testMapKeyNoAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm5.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertEquals( "", reader.getAnnotation( MapKey.class ).name() ); + } + + public void testMapKeyAllAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm6.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertEquals( "field2", reader.getAnnotation( MapKey.class ).name() ); + } + + public void testMapKeyClass() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm7.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertEquals( Entity2.class, reader.getAnnotation( MapKeyClass.class ) + .value() ); + } + + public void testMapKeyTemporal() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm8.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertEquals( TemporalType.DATE, reader.getAnnotation( + MapKeyTemporal.class ).value() ); + } + + public void testMapKeyEnumerated() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm9.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertEquals( EnumType.STRING, reader.getAnnotation( + MapKeyEnumerated.class ).value() ); + } + + /** + * When there's a single map key attribute override, we still wrap it with + * an AttributeOverrides annotation. + */ + public void testSingleMapKeyAttributeOverride() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm10.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationPresent( AttributeOverrides.class ); + AttributeOverrides overridesAnno = reader + .getAnnotation( AttributeOverrides.class ); + AttributeOverride[] overrides = overridesAnno.value(); + assertEquals( 1, overrides.length ); + assertEquals( "field1", overrides[0].name() ); + assertEquals( "col1", overrides[0].column().name() ); + } + + public void testMultipleMapKeyAttributeOverrides() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm11.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationPresent( AttributeOverrides.class ); + AttributeOverrides overridesAnno = reader + .getAnnotation( AttributeOverrides.class ); + AttributeOverride[] overrides = overridesAnno.value(); + assertEquals( 2, overrides.length ); + assertEquals( "field1", overrides[0].name() ); + assertEquals( "", overrides[0].column().name() ); + assertFalse( overrides[0].column().unique() ); + assertTrue( overrides[0].column().nullable() ); + assertTrue( overrides[0].column().insertable() ); + assertTrue( overrides[0].column().updatable() ); + assertEquals( "", overrides[0].column().columnDefinition() ); + assertEquals( "", overrides[0].column().table() ); + assertEquals( 255, overrides[0].column().length() ); + assertEquals( 0, overrides[0].column().precision() ); + assertEquals( 0, overrides[0].column().scale() ); + assertEquals( "field2", overrides[1].name() ); + assertEquals( "col1", overrides[1].column().name() ); + assertTrue( overrides[1].column().unique() ); + assertFalse( overrides[1].column().nullable() ); + assertFalse( overrides[1].column().insertable() ); + assertFalse( overrides[1].column().updatable() ); + assertEquals( "int", overrides[1].column().columnDefinition() ); + assertEquals( "table1", overrides[1].column().table() ); + assertEquals( 50, overrides[1].column().length() ); + assertEquals( 2, overrides[1].column().precision() ); + assertEquals( 1, overrides[1].column().scale() ); + } + + public void testMapKeyColumnNoAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm12.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + MapKeyColumn keyColAnno = reader.getAnnotation( MapKeyColumn.class ); + assertEquals( "", keyColAnno.columnDefinition() ); + assertEquals( "", keyColAnno.name() ); + assertEquals( "", keyColAnno.table() ); + assertFalse( keyColAnno.nullable() ); + assertTrue( keyColAnno.insertable() ); + assertFalse( keyColAnno.unique() ); + assertTrue( keyColAnno.updatable() ); + assertEquals( 255, keyColAnno.length() ); + assertEquals( 0, keyColAnno.precision() ); + assertEquals( 0, keyColAnno.scale() ); + } + + public void testMapKeyColumnAllAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm13.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + MapKeyColumn keyColAnno = reader.getAnnotation( MapKeyColumn.class ); + assertEquals( "int", keyColAnno.columnDefinition() ); + assertEquals( "col1", keyColAnno.name() ); + assertEquals( "table1", keyColAnno.table() ); + assertTrue( keyColAnno.nullable() ); + assertFalse( keyColAnno.insertable() ); + assertTrue( keyColAnno.unique() ); + assertFalse( keyColAnno.updatable() ); + assertEquals( 50, keyColAnno.length() ); + assertEquals( 2, keyColAnno.precision() ); + assertEquals( 1, keyColAnno.scale() ); + } + + /** + * When there's a single map key join column, we still wrap it with a + * MapKeyJoinColumns annotation. + */ + public void testSingleMapKeyJoinColumn() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm14.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + MapKeyJoinColumns joinColumnsAnno = reader + .getAnnotation( MapKeyJoinColumns.class ); + MapKeyJoinColumn[] joinColumns = joinColumnsAnno.value(); + assertEquals( 1, joinColumns.length ); + assertEquals( "col1", joinColumns[0].name() ); + } + + public void testMultipleMapKeyJoinColumns() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm15.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + MapKeyJoinColumns joinColumnsAnno = reader + .getAnnotation( MapKeyJoinColumns.class ); + MapKeyJoinColumn[] joinColumns = joinColumnsAnno.value(); + assertEquals( 2, joinColumns.length ); + assertEquals( "", joinColumns[0].name() ); + assertEquals( "", joinColumns[0].referencedColumnName() ); + assertFalse( joinColumns[0].unique() ); + assertFalse( joinColumns[0].nullable() ); + assertTrue( joinColumns[0].insertable() ); + assertTrue( joinColumns[0].updatable() ); + assertEquals( "", joinColumns[0].columnDefinition() ); + assertEquals( "", joinColumns[0].table() ); + assertEquals( "col1", joinColumns[1].name() ); + assertEquals( "col2", joinColumns[1].referencedColumnName() ); + assertTrue( joinColumns[1].unique() ); + assertTrue( joinColumns[1].nullable() ); + assertFalse( joinColumns[1].insertable() ); + assertFalse( joinColumns[1].updatable() ); + assertEquals( "int", joinColumns[1].columnDefinition() ); + assertEquals( "table1", joinColumns[1].table() ); + } + + public void testColumnNoAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm16.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( Column.class ); + Column column = reader.getAnnotation( Column.class ); + assertEquals( "", column.name() ); + assertFalse( column.unique() ); + assertTrue( column.nullable() ); + assertTrue( column.insertable() ); + assertTrue( column.updatable() ); + assertEquals( "", column.columnDefinition() ); + assertEquals( "", column.table() ); + assertEquals( 255, column.length() ); + assertEquals( 0, column.precision() ); + assertEquals( 0, column.scale() ); + } + + public void testColumnAllAttributes() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm17.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( Column.class ); + Column column = reader.getAnnotation( Column.class ); + assertEquals( "col1", column.name() ); + assertTrue( column.unique() ); + assertFalse( column.nullable() ); + assertFalse( column.insertable() ); + assertFalse( column.updatable() ); + assertEquals( "int", column.columnDefinition() ); + assertEquals( "table1", column.table() ); + assertEquals( 50, column.length() ); + assertEquals( 2, column.precision() ); + assertEquals( 1, column.scale() ); + } + + public void testTemporal() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm18.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( Temporal.class ); + assertAnnotationNotPresent( Enumerated.class ); + assertAnnotationNotPresent( Lob.class ); + assertEquals( TemporalType.DATE, reader.getAnnotation( + Temporal.class ).value() ); + } + + public void testEnumerated() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm19.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( Temporal.class ); + assertAnnotationPresent( Enumerated.class ); + assertAnnotationNotPresent( Lob.class ); + assertEquals( EnumType.STRING, reader.getAnnotation( + Enumerated.class ).value() ); + } + + public void testLob() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm20.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( Temporal.class ); + assertAnnotationNotPresent( Enumerated.class ); + assertAnnotationPresent( Lob.class ); + } + + /** + * When there's a single attribute override, we still wrap it with an + * AttributeOverrides annotation. + */ + public void testSingleAttributeOverride() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm21.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationPresent( AttributeOverrides.class ); + AttributeOverrides overridesAnno = reader + .getAnnotation( AttributeOverrides.class ); + AttributeOverride[] overrides = overridesAnno.value(); + assertEquals( 1, overrides.length ); + assertEquals( "field1", overrides[0].name() ); + assertEquals( "col1", overrides[0].column().name() ); + } + + public void testMultipleAttributeOverrides() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm22.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationPresent( AttributeOverrides.class ); + AttributeOverrides overridesAnno = reader + .getAnnotation( AttributeOverrides.class ); + AttributeOverride[] overrides = overridesAnno.value(); + assertEquals( 2, overrides.length ); + assertEquals( "field1", overrides[0].name() ); + assertEquals( "", overrides[0].column().name() ); + assertFalse( overrides[0].column().unique() ); + assertTrue( overrides[0].column().nullable() ); + assertTrue( overrides[0].column().insertable() ); + assertTrue( overrides[0].column().updatable() ); + assertEquals( "", overrides[0].column().columnDefinition() ); + assertEquals( "", overrides[0].column().table() ); + assertEquals( 255, overrides[0].column().length() ); + assertEquals( 0, overrides[0].column().precision() ); + assertEquals( 0, overrides[0].column().scale() ); + assertEquals( "field2", overrides[1].name() ); + assertEquals( "col1", overrides[1].column().name() ); + assertTrue( overrides[1].column().unique() ); + assertFalse( overrides[1].column().nullable() ); + assertFalse( overrides[1].column().insertable() ); + assertFalse( overrides[1].column().updatable() ); + assertEquals( "int", overrides[1].column().columnDefinition() ); + assertEquals( "table1", overrides[1].column().table() ); + assertEquals( 50, overrides[1].column().length() ); + assertEquals( 2, overrides[1].column().precision() ); + assertEquals( 1, overrides[1].column().scale() ); + } + + /** + * Tests that map-key-attribute-override and attribute-override elements + * both end up in the AttributeOverrides annotation. + */ + public void testMixedAttributeOverrides() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm23.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationPresent( AttributeOverrides.class ); + AttributeOverrides overridesAnno = reader + .getAnnotation( AttributeOverrides.class ); + AttributeOverride[] overrides = overridesAnno.value(); + assertEquals( 2, overrides.length ); + assertEquals( "field1", overrides[0].name() ); + assertEquals( "col1", overrides[0].column().name() ); + assertEquals( "field2", overrides[1].name() ); + assertEquals( "col2", overrides[1].column().name() ); + } + + /** + * When there's a single association override, we still wrap it with an + * AssociationOverrides annotation. + */ + public void testSingleAssociationOverride() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm24.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( AssociationOverride.class ); + assertAnnotationPresent( AssociationOverrides.class ); + AssociationOverrides overridesAnno = reader.getAnnotation( AssociationOverrides.class ); + AssociationOverride[] overrides = overridesAnno.value(); + assertEquals( 1, overrides.length ); + assertEquals( "association1", overrides[0].name() ); + assertEquals( 0, overrides[0].joinColumns().length ); + assertEquals( "", overrides[0].joinTable().name() ); + } + + public void testMultipleAssociationOverridesJoinColumns() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm25.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( AssociationOverride.class ); + assertAnnotationPresent( AssociationOverrides.class ); + AssociationOverrides overridesAnno = reader.getAnnotation( AssociationOverrides.class ); + AssociationOverride[] overrides = overridesAnno.value(); + assertEquals( 2, overrides.length ); + //First, an association using join table + assertEquals( "association1", overrides[0].name() ); + assertEquals( 0, overrides[0].joinColumns().length ); + + JoinTable joinTableAnno = overrides[0].joinTable(); + assertEquals( "catalog1", joinTableAnno.catalog() ); + assertEquals( "table1", joinTableAnno.name() ); + assertEquals( "schema1", joinTableAnno.schema() ); + + //JoinColumns + JoinColumn[] joinColumns = joinTableAnno.joinColumns(); + assertEquals( 2, joinColumns.length ); + assertEquals( "", joinColumns[0].name() ); + assertEquals( "", joinColumns[0].referencedColumnName() ); + assertEquals( "", joinColumns[0].table() ); + assertEquals( "", joinColumns[0].columnDefinition() ); + assertTrue( joinColumns[0].insertable() ); + assertTrue( joinColumns[0].updatable() ); + assertTrue( joinColumns[0].nullable() ); + assertFalse( joinColumns[0].unique() ); + assertEquals( "col1", joinColumns[1].name() ); + assertEquals( "col2", joinColumns[1].referencedColumnName() ); + assertEquals( "table2", joinColumns[1].table() ); + assertEquals( "int", joinColumns[1].columnDefinition() ); + assertFalse( joinColumns[1].insertable() ); + assertFalse( joinColumns[1].updatable() ); + assertFalse( joinColumns[1].nullable() ); + assertTrue( joinColumns[1].unique() ); + + //InverseJoinColumns + JoinColumn[] inverseJoinColumns = joinTableAnno.inverseJoinColumns(); + assertEquals( 2, inverseJoinColumns.length ); + assertEquals( "", inverseJoinColumns[0].name() ); + assertEquals( "", inverseJoinColumns[0].referencedColumnName() ); + assertEquals( "", inverseJoinColumns[0].table() ); + assertEquals( "", inverseJoinColumns[0].columnDefinition() ); + assertTrue( inverseJoinColumns[0].insertable() ); + assertTrue( inverseJoinColumns[0].updatable() ); + assertTrue( inverseJoinColumns[0].nullable() ); + assertFalse( inverseJoinColumns[0].unique() ); + assertEquals( "col3", inverseJoinColumns[1].name() ); + assertEquals( "col4", inverseJoinColumns[1].referencedColumnName() ); + assertEquals( "table3", inverseJoinColumns[1].table() ); + assertEquals( "int", inverseJoinColumns[1].columnDefinition() ); + assertFalse( inverseJoinColumns[1].insertable() ); + assertFalse( inverseJoinColumns[1].updatable() ); + assertFalse( inverseJoinColumns[1].nullable() ); + assertTrue( inverseJoinColumns[1].unique() ); + + //UniqueConstraints + UniqueConstraint[] uniqueConstraints = joinTableAnno + .uniqueConstraints(); + assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); + assertEquals( 1, uniqueConstraints[0].columnNames().length ); + assertEquals( "col5", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); + assertEquals( 2, uniqueConstraints[1].columnNames().length ); + assertEquals( "col6", uniqueConstraints[1].columnNames()[0] ); + assertEquals( "col7", uniqueConstraints[1].columnNames()[1] ); + + //Second, an association using join columns + assertEquals( "association2", overrides[1].name() ); + + //JoinColumns + joinColumns = overrides[1].joinColumns(); + assertEquals( 2, joinColumns.length ); + assertEquals( "", joinColumns[0].name() ); + assertEquals( "", joinColumns[0].referencedColumnName() ); + assertEquals( "", joinColumns[0].table() ); + assertEquals( "", joinColumns[0].columnDefinition() ); + assertTrue( joinColumns[0].insertable() ); + assertTrue( joinColumns[0].updatable() ); + assertTrue( joinColumns[0].nullable() ); + assertFalse( joinColumns[0].unique() ); + assertEquals( "col8", joinColumns[1].name() ); + assertEquals( "col9", joinColumns[1].referencedColumnName() ); + assertEquals( "table4", joinColumns[1].table() ); + assertEquals( "int", joinColumns[1].columnDefinition() ); + assertFalse( joinColumns[1].insertable() ); + assertFalse( joinColumns[1].updatable() ); + assertFalse( joinColumns[1].nullable() ); + assertTrue( joinColumns[1].unique() ); + } + + public void testCollectionTableNoChildren() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm26.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( CollectionTable.class ); + CollectionTable tableAnno = reader.getAnnotation( CollectionTable.class ); + assertEquals( "", tableAnno.name() ); + assertEquals( "", tableAnno.catalog() ); + assertEquals( "", tableAnno.schema() ); + assertEquals( 0, tableAnno.joinColumns().length ); + assertEquals( 0, tableAnno.uniqueConstraints().length ); + } + + public void testCollectionTableAllChildren() throws Exception { + reader = getReader( Entity3.class, "field1", "element-collection.orm27.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationPresent( CollectionTable.class ); + CollectionTable tableAnno = reader.getAnnotation( CollectionTable.class ); + assertEquals( "table1", tableAnno.name() ); + assertEquals( "catalog1", tableAnno.catalog() ); + assertEquals( "schema1", tableAnno.schema() ); + + //JoinColumns + JoinColumn[] joinColumns = tableAnno.joinColumns(); + assertEquals( 2, joinColumns.length ); + assertEquals( "", joinColumns[0].name() ); + assertEquals( "", joinColumns[0].referencedColumnName() ); + assertEquals( "", joinColumns[0].table() ); + assertEquals( "", joinColumns[0].columnDefinition() ); + assertTrue( joinColumns[0].insertable() ); + assertTrue( joinColumns[0].updatable() ); + assertTrue( joinColumns[0].nullable() ); + assertFalse( joinColumns[0].unique() ); + assertEquals( "col1", joinColumns[1].name() ); + assertEquals( "col2", joinColumns[1].referencedColumnName() ); + assertEquals( "table2", joinColumns[1].table() ); + assertEquals( "int", joinColumns[1].columnDefinition() ); + assertFalse( joinColumns[1].insertable() ); + assertFalse( joinColumns[1].updatable() ); + assertFalse( joinColumns[1].nullable() ); + assertTrue( joinColumns[1].unique() ); + + //UniqueConstraints + UniqueConstraint[] uniqueConstraints = tableAnno.uniqueConstraints(); + assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); + assertEquals( 1, uniqueConstraints[0].columnNames().length ); + assertEquals( "col3", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); + assertEquals( 2, uniqueConstraints[1].columnNames().length ); + assertEquals( "col4", uniqueConstraints[1].columnNames()[0] ); + assertEquals( "col5", uniqueConstraints[1].columnNames()[1] ); + } + + public void testAllAttributes() throws Exception { + reader = getReader( Entity2.class, "field1", "element-collection.orm28.xml" ); + assertAnnotationPresent( ElementCollection.class ); + assertAnnotationNotPresent( OrderBy.class ); + assertAnnotationNotPresent( OrderColumn.class ); + assertAnnotationNotPresent( MapKey.class ); + assertAnnotationNotPresent( MapKeyClass.class ); + assertAnnotationNotPresent( MapKeyTemporal.class ); + assertAnnotationNotPresent( MapKeyEnumerated.class ); + assertAnnotationNotPresent( MapKeyColumn.class ); + assertAnnotationNotPresent( MapKeyJoinColumns.class ); + assertAnnotationNotPresent( MapKeyJoinColumn.class ); + assertAnnotationNotPresent( Column.class ); + assertAnnotationNotPresent( Temporal.class ); + assertAnnotationNotPresent( Enumerated.class ); + assertAnnotationNotPresent( Lob.class ); + assertAnnotationNotPresent( AttributeOverride.class ); + assertAnnotationNotPresent( AttributeOverrides.class ); + assertAnnotationNotPresent( AssociationOverride.class ); + assertAnnotationNotPresent( AssociationOverrides.class ); + assertAnnotationNotPresent( CollectionTable.class ); + assertAnnotationPresent( Access.class ); + ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); + assertEquals( FetchType.EAGER, relAnno.fetch() ); + assertEquals( Entity3.class, relAnno.targetClass() ); + assertEquals( AccessType.PROPERTY, reader.getAnnotation( Access.class ) + .value() ); + } + + //TODO: tests for merging/overriding +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToManyTest.java index 7117395435..589213efbc 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToManyTest.java @@ -42,14 +42,13 @@ import javax.persistence.MapKeyEnumerated; import javax.persistence.MapKeyJoinColumn; import javax.persistence.MapKeyJoinColumns; import javax.persistence.MapKeyTemporal; -import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.OrderColumn; import javax.persistence.TemporalType; import javax.persistence.UniqueConstraint; public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { - + public void testNoChildren() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm1.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -70,7 +69,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( "", relAnno.mappedBy() ); assertEquals( void.class, relAnno.targetEntity() ); } - + public void testOrderBy() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm2.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -79,7 +78,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( "col1 ASC, col2 DESC", reader.getAnnotation( OrderBy.class ) .value() ); } - + public void testOrderColumnNoAttributes() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm3.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -92,7 +91,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertTrue( orderColumnAnno.nullable() ); assertTrue( orderColumnAnno.updatable() ); } - + public void testOrderColumnAllAttributes() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm4.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -105,7 +104,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertFalse( orderColumnAnno.nullable() ); assertFalse( orderColumnAnno.updatable() ); } - + public void testMapKeyNoAttributes() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm5.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -118,7 +117,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertEquals( "", reader.getAnnotation( MapKey.class ).name() ); } - + public void testMapKeyAllAttributes() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm6.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -131,7 +130,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertEquals( "field2", reader.getAnnotation( MapKey.class ).name() ); } - + public void testMapKeyClass() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm7.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -145,7 +144,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( Entity2.class, reader.getAnnotation( MapKeyClass.class ) .value() ); } - + public void testMapKeyTemporal() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm8.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -159,7 +158,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( TemporalType.DATE, reader.getAnnotation( MapKeyTemporal.class ).value() ); } - + public void testMapKeyEnumerated() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm9.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -173,7 +172,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( EnumType.STRING, reader.getAnnotation( MapKeyEnumerated.class ).value() ); } - + /** * When there's a single map key attribute override, we still wrap it with * an AttributeOverrides annotation. @@ -197,7 +196,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( "field1", overrides[0].name() ); assertEquals( "col1", overrides[0].column().name() ); } - + public void testMultipleMapKeyAttributeOverrides() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm11.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -237,7 +236,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( 2, overrides[1].column().precision() ); assertEquals( 1, overrides[1].column().scale() ); } - + public void testMapKeyColumnNoAttributes() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm12.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -260,7 +259,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( 0, keyColAnno.precision() ); assertEquals( 0, keyColAnno.scale() ); } - + public void testMapKeyColumnAllAttributes() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm13.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -283,7 +282,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( 2, keyColAnno.precision() ); assertEquals( 1, keyColAnno.scale() ); } - + /** * When there's a single map key join column, we still wrap it with a * MapKeyJoinColumns annotation. @@ -304,7 +303,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( 1, joinColumns.length ); assertEquals( "col1", joinColumns[0].name() ); } - + public void testMultipleMapKeyJoinColumns() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm15.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -336,7 +335,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( "int", joinColumns[1].columnDefinition() ); assertEquals( "table1", joinColumns[1].table() ); } - + public void testJoinTableNoChildren() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm16.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -351,7 +350,7 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { assertEquals( 0, joinTableAnno.inverseJoinColumns().length ); assertEquals( 0, joinTableAnno.uniqueConstraints().length ); } - + public void testJoinTableAllChildren() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm17.xml" ); assertAnnotationPresent( ManyToMany.class ); @@ -407,13 +406,15 @@ public class Ejb3XmlManyToManyTest extends Ejb3XmlTestCase { UniqueConstraint[] uniqueConstraints = joinTableAnno .uniqueConstraints(); assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); assertEquals( 1, uniqueConstraints[0].columnNames().length ); assertEquals( "col5", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); assertEquals( 2, uniqueConstraints[1].columnNames().length ); assertEquals( "col6", uniqueConstraints[1].columnNames()[0] ); assertEquals( "col7", uniqueConstraints[1].columnNames()[1] ); } - + public void testCascadeAll() throws Exception { reader = getReader( Entity2.class, "field1", "many-to-many.orm18.xml" ); assertAnnotationPresent( ManyToMany.class ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToOneTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToOneTest.java index 3702d1bfce..031f0011ec 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlManyToOneTest.java @@ -169,8 +169,10 @@ public class Ejb3XmlManyToOneTest extends Ejb3XmlTestCase { UniqueConstraint[] uniqueConstraints = joinTableAnno .uniqueConstraints(); assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); assertEquals( 1, uniqueConstraints[0].columnNames().length ); assertEquals( "col5", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); assertEquals( 2, uniqueConstraints[1].columnNames().length ); assertEquals( "col6", uniqueConstraints[1].columnNames()[0] ); assertEquals( "col7", uniqueConstraints[1].columnNames()[1] ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToManyTest.java index 5c9db77c50..ea59d8b1c5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToManyTest.java @@ -409,8 +409,10 @@ public class Ejb3XmlOneToManyTest extends Ejb3XmlTestCase { UniqueConstraint[] uniqueConstraints = joinTableAnno .uniqueConstraints(); assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); assertEquals( 1, uniqueConstraints[0].columnNames().length ); assertEquals( "col5", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); assertEquals( 2, uniqueConstraints[1].columnNames().length ); assertEquals( "col6", uniqueConstraints[1].columnNames()[0] ); assertEquals( "col7", uniqueConstraints[1].columnNames()[1] ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOnetoOneTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToOneTest.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOnetoOneTest.java rename to hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToOneTest.java index b1f86b6115..5c7e4f940e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOnetoOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlOneToOneTest.java @@ -38,7 +38,8 @@ import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.PrimaryKeyJoinColumns; import javax.persistence.UniqueConstraint; -public class Ejb3XmlOnetoOneTest extends Ejb3XmlTestCase { +public class Ejb3XmlOneToOneTest extends Ejb3XmlTestCase { + public void testNoChildren() throws Exception { reader = getReader( Entity1.class, "field1", "one-to-one.orm1.xml" ); assertAnnotationPresent( OneToOne.class ); @@ -98,7 +99,6 @@ public class Ejb3XmlOnetoOneTest extends Ejb3XmlTestCase { assertEquals( "col1", joinColumns[1].name() ); assertEquals( "col2", joinColumns[1].referencedColumnName() ); assertEquals( "int", joinColumns[1].columnDefinition() ); - } /** @@ -224,8 +224,10 @@ public class Ejb3XmlOnetoOneTest extends Ejb3XmlTestCase { UniqueConstraint[] uniqueConstraints = joinTableAnno .uniqueConstraints(); assertEquals( 2, uniqueConstraints.length ); + assertEquals( "", uniqueConstraints[0].name() ); assertEquals( 1, uniqueConstraints[0].columnNames().length ); assertEquals( "col5", uniqueConstraints[0].columnNames()[0] ); + assertEquals( "uq1", uniqueConstraints[1].name() ); assertEquals( 2, uniqueConstraints[1].columnNames().length ); assertEquals( "col6", uniqueConstraints[1].columnNames()[0] ); assertEquals( "col7", uniqueConstraints[1].columnNames()[1] ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTestCase.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTestCase.java index 71c8922041..1274bb6869 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTestCase.java @@ -30,19 +30,48 @@ import java.lang.reflect.AnnotatedElement; import org.dom4j.Document; import org.dom4j.io.SAXReader; +import org.hibernate.Hibernate; import org.hibernate.cfg.annotations.reflection.JPAOverridenAnnotationReader; import org.hibernate.cfg.annotations.reflection.XMLContext; import org.hibernate.test.annotations.TestCase; +import org.hibernate.testing.junit.functional.annotations.HibernateTestCase; -abstract class Ejb3XmlTestCase extends TestCase { +/** + * Test superclass to provide utility methods for testing the mapping of JPA + * XML to JPA annotations. The configuration is built within each test, and no + * database is used. Thus, no schema generation or cleanup will be performed. + */ +abstract class Ejb3XmlTestCase extends HibernateTestCase { protected JPAOverridenAnnotationReader reader; + @Override + protected void buildConfiguration() throws Exception { + //Do nothing + } + + @Override + protected void runSchemaGeneration() { + //Do nothing + } + + @Override + protected void runSchemaDrop() { + //Do nothing + } + + @Override + protected void handleUnclosedResources() { + //Do nothing + } + protected void assertAnnotationPresent(Class annotationType) { - assertTrue( reader.isAnnotationPresent( annotationType ) ); + assertTrue( "Expected annotation " + annotationType.getSimpleName() + " was not present", + reader.isAnnotationPresent( annotationType ) ); } protected void assertAnnotationNotPresent(Class annotationType) { - assertFalse( reader.isAnnotationPresent( annotationType ) ); + assertFalse( "Unexpected annotation " + annotationType.getSimpleName() + " was present", + reader.isAnnotationPresent( annotationType ) ); } protected JPAOverridenAnnotationReader getReader(Class entityClass, String fieldName, String ormResourceName) diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm1.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm1.xml new file mode 100644 index 0000000000..39d0b6c2bd --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm1.xml @@ -0,0 +1,39 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm10.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm10.xml new file mode 100644 index 0000000000..9fc97aa7f2 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm10.xml @@ -0,0 +1,43 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm11.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm11.xml new file mode 100644 index 0000000000..5845fcc58d --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm11.xml @@ -0,0 +1,48 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm12.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm12.xml new file mode 100644 index 0000000000..6f696ebf02 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm12.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm13.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm13.xml new file mode 100644 index 0000000000..3c0291a6e3 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm13.xml @@ -0,0 +1,43 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm14.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm14.xml new file mode 100644 index 0000000000..975253d716 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm14.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm15.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm15.xml new file mode 100644 index 0000000000..d202c83800 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm15.xml @@ -0,0 +1,45 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm16.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm16.xml new file mode 100644 index 0000000000..7406860f8f --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm16.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm17.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm17.xml new file mode 100644 index 0000000000..6292910750 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm17.xml @@ -0,0 +1,43 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm18.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm18.xml new file mode 100644 index 0000000000..d7186b3cd8 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm18.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + DATE + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm19.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm19.xml new file mode 100644 index 0000000000..843c2e41f2 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm19.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + STRING + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm2.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm2.xml new file mode 100644 index 0000000000..27ba02b6ac --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm2.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + col1 ASC, col2 DESC + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm20.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm20.xml new file mode 100644 index 0000000000..aafc75ff0f --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm20.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm21.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm21.xml new file mode 100644 index 0000000000..0285477126 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm21.xml @@ -0,0 +1,43 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm22.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm22.xml new file mode 100644 index 0000000000..3e8ac599c0 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm22.xml @@ -0,0 +1,48 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm23.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm23.xml new file mode 100644 index 0000000000..2f12cb2aa6 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm23.xml @@ -0,0 +1,46 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm24.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm24.xml new file mode 100644 index 0000000000..23ed039b90 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm24.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm25.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm25.xml new file mode 100644 index 0000000000..b21add2b19 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm25.xml @@ -0,0 +1,65 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + + + + col5 + + + col6 + col7 + + + + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm26.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm26.xml new file mode 100644 index 0000000000..18a13dfd9e --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm26.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm27.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm27.xml new file mode 100644 index 0000000000..481ddd3e61 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm27.xml @@ -0,0 +1,54 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + col3 + + + col4 + col5 + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm28.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm28.xml new file mode 100644 index 0000000000..cb15072f5c --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm28.xml @@ -0,0 +1,40 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm3.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm3.xml new file mode 100644 index 0000000000..d943725cab --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm3.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm4.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm4.xml new file mode 100644 index 0000000000..72167b53fe --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm4.xml @@ -0,0 +1,42 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm5.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm5.xml new file mode 100644 index 0000000000..0b994b97f0 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm5.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm6.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm6.xml new file mode 100644 index 0000000000..3d43ea42aa --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm6.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm7.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm7.xml new file mode 100644 index 0000000000..27ad58b145 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm7.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm8.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm8.xml new file mode 100644 index 0000000000..1b5d584e0c --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm8.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + DATE + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm9.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm9.xml new file mode 100644 index 0000000000..8d9eac8d56 --- /dev/null +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/element-collection.orm9.xml @@ -0,0 +1,41 @@ + + + + + + + + org.hibernate.test.annotations.xml.ejb3 + + + + STRING + + + + diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-many.orm17.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-many.orm17.xml index 4a9605cd94..64e3d5573f 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-many.orm17.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-many.orm17.xml @@ -46,7 +46,7 @@ col5 - + col6 col7 diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-one.orm5.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-one.orm5.xml index 19bbc8df0a..b066e1f219 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-one.orm5.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/many-to-one.orm5.xml @@ -46,7 +46,7 @@ col5 - + col6 col7 diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-many.orm17.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-many.orm17.xml index cffb4345b5..18c080145a 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-many.orm17.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-many.orm17.xml @@ -46,7 +46,7 @@ col5 - + col6 col7 diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-one.orm7.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-one.orm7.xml index aa24986324..5dc3c17db3 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-one.orm7.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/one-to-one.orm7.xml @@ -46,7 +46,7 @@ col5 - + col6 col7