-->
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: foreign key, with composite table
PostPosted: Tue Sep 27, 2011 1:39 pm 
Newbie

Joined: Tue Sep 27, 2011 1:31 pm
Posts: 1
I get an exception when creating the tables. I understood the problem but how do I solve this?
Exception:
Invocation of init method failed; nested exception is org.hibernate.AnnotationExcepti
on: A Foreign key refering com.kids.crm.db.Truck from com.kids.crm.db.TruckWoodP
rice has the wrong number of column. should be 2
Code:
@Entity
@IdClass (TruckWoodPriceId.class)
@Table(name = "truck_wood_price")
public class TruckWoodPrice {
       @Id
   private Truck truck;
       @Id
   private WoodType woodType;
        @Id
   private Double price;
       @Id
   private Integer truckYear;
//getters and setters
}

@Embeddable
public class TruckWoodPriceId{
   private Truck truck;
   private WoodType woodType;
   private Double price;
   private Integer truckYear;
//getters and setters
}


@Entity
@IdClass (TruckId.class)
@Table(name = "truck")
public class Truck extends Persistent{
       @Id
   private Long id;
   private Double cft;.
        @Id
   private Integer truckYear;
   private WholeSaleMember wholeSaleMember;

//getters and setters
}

@Embeddable
public class TruckId implements Serializable{
   private Long id;
   private Integer truckYear;
}


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.