-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Property not found with referencedColumnName from @IdClass
PostPosted: Thu Dec 06, 2007 8:25 pm 
Newbie

Joined: Thu Dec 06, 2007 7:41 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.