diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java index 0724fc0d9e..8e58c07aa9 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/binder/Binder.java @@ -1074,7 +1074,15 @@ public class Binder { } // If any entity hierarchies cannot be resolved, then throw exception. if ( ! unresolvedEntityHierarchies.isEmpty() ) { - throw new IllegalStateException( "could not resolve all EntityHierarchies." ); + StringBuilder buffer = new StringBuilder(); + String sep = ""; + for ( EntityHierarchySource unresolved : unresolvedEntityHierarchies ) { + buffer.append( sep ).append( unresolved.getRoot().getEntityName() ); + sep = ", "; + } + throw new IllegalStateException( + "Could not resolve all EntityHierarchies; remaining = {" + buffer.toString() + "}" + ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java b/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java index ba43927fea..06d25486d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java @@ -568,6 +568,10 @@ public final class PropertyFactory { final Type type = property.getHibernateTypeDescriptor().getResolvedTypeMapping(); + if ( type == null ) { + throw new HibernateException( "Unable to determine attribute type : " + property.getAttributeRole().getFullPath() ); + } + // we need to dirty check collections, since they can cause an owner // version number increment diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java index d2bc352ac7..0a083afc02 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java @@ -47,8 +47,10 @@ import static org.junit.Assert.assertNotNull; * @author Emmanuel Bernard */ @FailureExpectedWithNewMetamodel( - message = "Problem processing one of the composite ids, but as there are sooooooooooo many its " + - "hard to tell which specifically causes the problem" + message = "Part of the problem is how some of the composite ids are defined. For example, " + + "quite a few map a logical `@Id @ManyToOne` combo without the @ManyToOne. Fixing those " + + "leads to an not being able to bind the org.hibernate.test.annotations.cid.A entity; it " + + "has composite id made up of 2 @OneToOnes (need to research that, why not @ManyToOne?)." ) public class CompositeIdTest extends BaseCoreFunctionalTestCase { @Test diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/OrderLine.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/OrderLine.java index f93d719ee4..21069ac3ca 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/OrderLine.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/OrderLine.java @@ -2,6 +2,7 @@ package org.hibernate.test.annotations.cid; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; +import javax.persistence.ManyToOne; /** * @author Emmanuel Bernard @@ -10,7 +11,9 @@ import javax.persistence.IdClass; @IdClass(OrderLinePk.class) public class OrderLine { @Id + @ManyToOne public Order order; @Id + @ManyToOne public Product product; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/TvProgramIdClass.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/TvProgramIdClass.java index 431881d5b1..1135c9083c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/TvProgramIdClass.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/cid/TvProgramIdClass.java @@ -6,6 +6,7 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.SecondaryTable; import javax.persistence.Temporal; @@ -20,9 +21,11 @@ import javax.persistence.TemporalType; @IdClass( TvMagazinPk.class ) public class TvProgramIdClass { @Id + @ManyToOne @JoinColumn(nullable=false) public Channel channel; @Id + @ManyToOne @JoinColumn(nullable=false) public Presenter presenter;