HHH-12581 - Revert original fix for HHH-12338 to address regression.
(cherry picked from commit df6d44f
)
This commit is contained in:
parent
e66d0689b4
commit
e8f4d0c8bc
|
@ -138,14 +138,6 @@ public class MetaAttributeGenerationVisitor extends SimpleTypeVisitor6<Annotatio
|
||||||
accessTypeInfo.setDefaultAccessType( entity.getEntityAccessTypeInfo().getAccessType() );
|
accessTypeInfo.setDefaultAccessType( entity.getEntityAccessTypeInfo().getAccessType() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( TypeUtils.containsAnnotation( element, Constants.CONVERT ) ||
|
|
||||||
TypeUtils.containsAnnotation( element, Constants.HIBERNATE_TYPE ) ) {
|
|
||||||
return new AnnotationMetaSingleAttribute(
|
|
||||||
entity,
|
|
||||||
element,
|
|
||||||
TypeUtils.toTypeString( declaredType )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ( collection.equals( Constants.MAP_ATTRIBUTE ) ) {
|
if ( collection.equals( Constants.MAP_ATTRIBUTE ) ) {
|
||||||
return createAnnotationMetaAttributeForMap( declaredType, element, collection, targetEntity );
|
return createAnnotationMetaAttributeForMap( declaredType, element, collection, targetEntity );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.jpamodelgen.test.collectionbasictype;
|
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
|
||||||
import org.hibernate.jpamodelgen.test.util.TestForIssue;
|
|
||||||
import org.hibernate.jpamodelgen.test.util.WithClasses;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertAttributeTypeInMetaModelFor;
|
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertListAttributeTypeInMetaModelFor;
|
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author helloztt
|
|
||||||
*/
|
|
||||||
public class CollectionAsBasicTypeTest extends CompilationTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestForIssue(jiraKey = "HHH-12338")
|
|
||||||
@WithClasses({Goods.class, Product.class})
|
|
||||||
public void testConvert() throws ClassNotFoundException, NoSuchFieldException {
|
|
||||||
assertMetamodelClassGeneratedFor(Product.class);
|
|
||||||
assertMetamodelClassGeneratedFor(Goods.class);
|
|
||||||
assertListAttributeTypeInMetaModelFor(
|
|
||||||
Goods.class,
|
|
||||||
"productList",
|
|
||||||
Product.class,
|
|
||||||
"ListAttribute generic type should be Product"
|
|
||||||
);
|
|
||||||
assertAttributeTypeInMetaModelFor(
|
|
||||||
Goods.class,
|
|
||||||
"tags",
|
|
||||||
Goods.class.getDeclaredField("tags").getGenericType(),
|
|
||||||
"Wrong meta model type"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestForIssue(jiraKey = "HHH-12338")
|
|
||||||
@WithClasses({Person.class})
|
|
||||||
public void testListType() throws ClassNotFoundException, NoSuchFieldException {
|
|
||||||
assertMetamodelClassGeneratedFor(Person.class);
|
|
||||||
|
|
||||||
assertAttributeTypeInMetaModelFor(
|
|
||||||
Person.class,
|
|
||||||
"phones",
|
|
||||||
Person.class.getDeclaredField("phones").getGenericType(),
|
|
||||||
"Wrong meta model type"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestForIssue(jiraKey = "HHH-12338")
|
|
||||||
@WithClasses({PersonPhone.class})
|
|
||||||
public void testListTypeWithImport() throws ClassNotFoundException, NoSuchFieldException {
|
|
||||||
assertMetamodelClassGeneratedFor(PersonPhone.class);
|
|
||||||
|
|
||||||
assertAttributeTypeInMetaModelFor(
|
|
||||||
PersonPhone.class,
|
|
||||||
"phones",
|
|
||||||
PersonPhone.class.getDeclaredField("phones").getGenericType(),
|
|
||||||
"Wrong meta model type"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestForIssue(jiraKey = "HHH-12338")
|
|
||||||
@WithClasses({PhoneBook.class})
|
|
||||||
public void testMapType() throws ClassNotFoundException, NoSuchFieldException {
|
|
||||||
assertMetamodelClassGeneratedFor(PhoneBook.class);
|
|
||||||
|
|
||||||
assertAttributeTypeInMetaModelFor(
|
|
||||||
PhoneBook.class,
|
|
||||||
"phones",
|
|
||||||
PhoneBook.class.getDeclaredField("phones").getGenericType(),
|
|
||||||
"Wrong meta model type"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue