FailureExpectedWithNewMetamodel cleanup
This commit is contained in:
parent
bab7fc6a47
commit
2b17b95980
|
@ -61,6 +61,7 @@ import org.hibernate.id.PersistentIdentifierGenerator;
|
||||||
import org.hibernate.id.enhanced.TableGenerator;
|
import org.hibernate.id.enhanced.TableGenerator;
|
||||||
import org.hibernate.internal.FilterConfiguration;
|
import org.hibernate.internal.FilterConfiguration;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.internal.binder.HibernateTypeHelper.ReflectedCollectionJavaTypes;
|
import org.hibernate.metamodel.internal.binder.HibernateTypeHelper.ReflectedCollectionJavaTypes;
|
||||||
import org.hibernate.metamodel.internal.resolver.AssociationRelationalBindingResolver;
|
import org.hibernate.metamodel.internal.resolver.AssociationRelationalBindingResolver;
|
||||||
import org.hibernate.metamodel.internal.resolver.MappedByAssociationRelationalBindingResolverImpl;
|
import org.hibernate.metamodel.internal.resolver.MappedByAssociationRelationalBindingResolverImpl;
|
||||||
|
@ -1569,10 +1570,7 @@ public class Binder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
joinRelationalValueBindings = new ArrayList<RelationalValueBinding>(
|
joinRelationalValueBindings = CollectionHelper.arrayList( joinedPrimaryKeyColumnSources.size() );
|
||||||
joinedPrimaryKeyColumnSources
|
|
||||||
.size()
|
|
||||||
);
|
|
||||||
if ( primaryKeyColumns.size() != joinedPrimaryKeyColumnSources.size() ) {
|
if ( primaryKeyColumns.size() != joinedPrimaryKeyColumnSources.size() ) {
|
||||||
throw localBindingContext().makeMappingException(
|
throw localBindingContext().makeMappingException(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.hibernate.metamodel.spi.NaturalIdMutability;
|
||||||
|
|
||||||
import org.jboss.jandex.AnnotationInstance;
|
import org.jboss.jandex.AnnotationInstance;
|
||||||
import org.jboss.jandex.AnnotationValue;
|
import org.jboss.jandex.AnnotationValue;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for the different types of persistent attributes
|
* Base class for the different types of persistent attributes
|
||||||
|
@ -52,6 +53,8 @@ import org.jboss.jandex.AnnotationValue;
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractPersistentAttribute implements PersistentAttribute {
|
public abstract class AbstractPersistentAttribute implements PersistentAttribute {
|
||||||
|
private static final Logger log = Logger.getLogger( AbstractPersistentAttribute.class );
|
||||||
|
|
||||||
private final ManagedTypeMetadata container;
|
private final ManagedTypeMetadata container;
|
||||||
private final String attributeName;
|
private final String attributeName;
|
||||||
private final AttributePath attributePath;
|
private final AttributePath attributePath;
|
||||||
|
@ -163,6 +166,12 @@ public abstract class AbstractPersistentAttribute implements PersistentAttribute
|
||||||
final AnnotationInstance idAnnotation = backingMember.getAnnotations().get( JPADotNames.ID );
|
final AnnotationInstance idAnnotation = backingMember.getAnnotations().get( JPADotNames.ID );
|
||||||
if ( idAnnotation != null ) {
|
if ( idAnnotation != null ) {
|
||||||
validatePresenceOfIdAnnotation();
|
validatePresenceOfIdAnnotation();
|
||||||
|
if ( backingMember.getType().getErasedType().findTypeAnnotation( JPADotNames.EMBEDDABLE ) != null ) {
|
||||||
|
log.warn(
|
||||||
|
"Attribute was annotated with @Id, but attribute type was annotated as @Embeddable; " +
|
||||||
|
"did you mean to use @EmbeddedId on the attribute rather than @Id?"
|
||||||
|
);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.metamodel.reflite.internal.ModifierUtils;
|
import org.hibernate.metamodel.reflite.internal.ModifierUtils;
|
||||||
import org.hibernate.metamodel.reflite.spi.ArrayDescriptor;
|
|
||||||
import org.hibernate.metamodel.reflite.spi.ClassDescriptor;
|
import org.hibernate.metamodel.reflite.spi.ClassDescriptor;
|
||||||
import org.hibernate.metamodel.reflite.spi.FieldDescriptor;
|
import org.hibernate.metamodel.reflite.spi.FieldDescriptor;
|
||||||
import org.hibernate.metamodel.reflite.spi.JavaTypeDescriptor;
|
import org.hibernate.metamodel.reflite.spi.JavaTypeDescriptor;
|
||||||
|
@ -973,10 +972,10 @@ public abstract class ManagedTypeMetadata implements OverrideAndConverterCollect
|
||||||
if ( isEmbeddableType( attributeType ) ) {
|
if ( isEmbeddableType( attributeType ) ) {
|
||||||
LOG.warnf(
|
LOG.warnf(
|
||||||
"Class %s was annotated as @Embeddable. However a persistent attribute [%s] " +
|
"Class %s was annotated as @Embeddable. However a persistent attribute [%s] " +
|
||||||
"of this type was found that did not contain the @Embedded annotation. " +
|
"of this type was found that did not contain the @Embedded (or @EmbeddedId) annotation. " +
|
||||||
"This may cause compatibility issues",
|
"This may cause compatibility issues",
|
||||||
attributeType.getName(),
|
attributeType.getName(),
|
||||||
member.toString()
|
member.toLoggableForm()
|
||||||
);
|
);
|
||||||
categories.add( AttributeCategorization.EMBEDDED );
|
categories.add( AttributeCategorization.EMBEDDED );
|
||||||
}
|
}
|
||||||
|
@ -1042,13 +1041,6 @@ public abstract class ManagedTypeMetadata implements OverrideAndConverterCollect
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("RedundantIfStatement")
|
|
||||||
private boolean isCollectionOrArray(JavaTypeDescriptor attributeType) {
|
|
||||||
return ArrayDescriptor.class.isInstance( attributeType )
|
|
||||||
|| getLocalBindingContext().getJavaTypeDescriptorRepository().jdkMapDescriptor().isAssignableFrom( attributeType )
|
|
||||||
|| getLocalBindingContext().getJavaTypeDescriptorRepository().jdkCollectionDescriptor().isAssignableFrom( attributeType );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isEmbeddableType(JavaTypeDescriptor descriptor) {
|
protected boolean isEmbeddableType(JavaTypeDescriptor descriptor) {
|
||||||
return descriptor.findTypeAnnotation( JPADotNames.EMBEDDABLE ) != null;
|
return descriptor.findTypeAnnotation( JPADotNames.EMBEDDABLE ) != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.hibernate.cache.spi.access.AccessType;
|
||||||
import org.hibernate.metamodel.spi.binding.Caching;
|
import org.hibernate.metamodel.spi.binding.Caching;
|
||||||
import org.hibernate.metamodel.spi.binding.EntityBinding;
|
import org.hibernate.metamodel.spi.binding.EntityBinding;
|
||||||
|
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase;
|
import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase;
|
||||||
import org.hibernate.testing.junit4.Resources;
|
import org.hibernate.testing.junit4.Resources;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -43,7 +42,6 @@ import org.junit.Test;
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
import static junit.framework.Assert.assertNull;
|
import static junit.framework.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@code o.h.a.Cache} and {@code j.p.Cacheable}.
|
* Tests for {@code o.h.a.Cache} and {@code j.p.Cacheable}.
|
||||||
|
@ -77,12 +75,12 @@ public class CacheBindingTest extends BaseAnnotationBindingTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Resources(annotatedClasses = NoCacheEntity.class, cacheMode = SharedCacheMode.NONE)
|
@Resources(annotatedClasses = NoCacheEntity.class, cacheMode = SharedCacheMode.NONE)
|
||||||
@FailureExpectedWithNewMetamodel( message = "I am not so sure that bindings/metamodel is the right place to deal with SharedCacheMode" )
|
|
||||||
public void testNoCaching() {
|
public void testNoCaching() {
|
||||||
EntityBinding binding = getEntityBinding( NoCacheEntity.class );
|
EntityBinding binding = getEntityBinding( NoCacheEntity.class );
|
||||||
assertFalse(
|
assertEquals(
|
||||||
"There should be no cache binding",
|
"There should be no cache binding",
|
||||||
binding.getHierarchyDetails().getCaching().getRequested() != TruthValue.TRUE
|
TruthValue.FALSE,
|
||||||
|
binding.getHierarchyDetails().getCaching().getRequested()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,25 +23,25 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.abstractembeddedcomponents.propertyref;
|
package org.hibernate.test.abstractembeddedcomponents.propertyref;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class AbstractComponentPropertyRefTest extends BaseCoreFunctionalTestCase {
|
public class AbstractComponentPropertyRefTest extends BaseCoreFunctionalTestCase {
|
||||||
public String[] getMappings() {
|
public String[] getMappings() {
|
||||||
return new String[] { "abstractembeddedcomponents/propertyref/Mappings.hbm.xml" };
|
return new String[] { "abstractembeddedcomponents/propertyref/Mappings.hbm.xml" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpectedWithNewMetamodel( jiraKey = "HHH-7242", message = "property-ref" )
|
||||||
public void testPropertiesRefCascades() {
|
public void testPropertiesRefCascades() {
|
||||||
Session session = openSession();
|
Session session = openSession();
|
||||||
Transaction trans = session.beginTransaction();
|
Transaction trans = session.beginTransaction();
|
||||||
|
|
|
@ -23,16 +23,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.test.annotations;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.test.annotations.inheritance.Carrot;
|
import org.hibernate.test.annotations.inheritance.Carrot;
|
||||||
import org.hibernate.test.annotations.inheritance.Tomato;
|
import org.hibernate.test.annotations.inheritance.Tomato;
|
||||||
import org.hibernate.test.annotations.inheritance.Vegetable;
|
import org.hibernate.test.annotations.inheritance.Vegetable;
|
||||||
import org.hibernate.test.annotations.inheritance.VegetablePk;
|
import org.hibernate.test.annotations.inheritance.VegetablePk;
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
import org.junit.Test;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
@ -41,7 +40,6 @@ import static org.junit.Assert.assertTrue;
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultValues() {
|
public void testDefaultValues() {
|
||||||
|
@ -129,6 +127,7 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
AmericaCupClass.class,
|
AmericaCupClass.class,
|
||||||
Country.class,
|
Country.class,
|
||||||
Vegetable.class,
|
Vegetable.class,
|
||||||
|
VegetablePk.class,
|
||||||
Carrot.class,
|
Carrot.class,
|
||||||
Tomato.class
|
Tomato.class
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//$Id$
|
|
||||||
package org.hibernate.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//$Id$
|
|
||||||
package org.hibernate.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
@ -9,6 +9,23 @@ import javax.persistence.Embeddable;
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public class VegetablePk implements Serializable {
|
public class VegetablePk implements Serializable {
|
||||||
private String farmer;
|
private String farmer;
|
||||||
|
private String harvestDate;
|
||||||
|
|
||||||
|
public String getFarmer() {
|
||||||
|
return farmer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFarmer(String farmer) {
|
||||||
|
this.farmer = farmer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHarvestDate() {
|
||||||
|
return harvestDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHarvestDate(String harvestDate) {
|
||||||
|
this.harvestDate = harvestDate;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( this == o ) return true;
|
if ( this == o ) return true;
|
||||||
|
@ -29,21 +46,4 @@ public class VegetablePk implements Serializable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFarmer() {
|
|
||||||
return farmer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFarmer(String farmer) {
|
|
||||||
this.farmer = farmer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHarvestDate() {
|
|
||||||
return harvestDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHarvestDate(String harvestDate) {
|
|
||||||
this.harvestDate = harvestDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String harvestDate;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue