Hibernate version: core: 3.2.5.ga, annotations: 3.3.0.ga
If a ManyToOne relation is defined on an @IdClass and the referencedColumnName is specified on the relation, I get the following error:
Code:
javax.persistence.PersistenceException: org.hibernate.MappingException: property [_ProductPricePosition_id.pricePosition] not found on entity [PricePosition]
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at TestCase.main(TestCase.java:14)
These are my entities:
Code:
@javax.persistence.Entity
public class ProductPricePosition implements Serializable {
@javax.persistence.EmbeddedId
private ProductPricePositionId id;
@javax.persistence.Version
private Timestamp mutts;
private String mutUid;
.........
}
@Embeddable()
public class ProductPricePositionId implements Serializable {
private Integer baseType;
@ManyToOne()
@JoinColumn(name="pricePosition", referencedColumnName="pricePosition")
private PricePosition pricePosition;
private Integer product;
........
}
@javax.persistence.Entity
public class PricePosition implements Serializable {
@javax.persistence.Id
private Long pricePositionId;
private Integer pricePosition;
......
}
If the ManyToOne relation refers to the primary key of PricePosition, the referencedColumnName is not needed and everything works fine.
Thanks for any help
tinu_l