-->
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.  [ 2 posts ] 
Author Message
 Post subject: "Could not determine type"-Problem with embedded key
PostPosted: Sun Apr 11, 2010 4:25 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hello,

I've the following three tables: Customer, Flight and Booking.
Customer and Flight do have their own PKs, whereas Booking is defined by the ID of Customer and Flight.

However hibernate complains it cant't find the type for the customer column:
Code:
Caused by: org.hibernate.MappingException: Could not determine type for: dst1.model.Customer, at table: Booking, for columns: [org.hibernate.mapping.Column(customer)]


Any idea what is causing the problem?

Thank you in advance, Clemens

Code:
@Entity
public class Flight {
    @Id @GeneratedValue
    Long id;

    @OneToMany(mappedBy="id.flight",  cascade={CascadeType.REMOVE})
    List<Booking> bookings = new ArrayList<Booking>();
}

@Entity
public class Customer extends Person {
    @Id @GeneratedValue
    Long id;

    @OneToMany(mappedBy="id.customer",  cascade={CascadeType.REMOVE})
    List<Booking> bookings = new ArrayList<Booking>();
}

@Entity
public class Booking {   
    @EmbeddedId
    BookingID id;
}

@Embeddable
public class BookingID implements Serializable {   
    @JoinColumn(name="customer_id", referencedColumnName="id")
    Customer customer;
   
    @JoinColumn(name="flight_id", referencedColumnName="id")
    Flight flight;
}


Top
 Profile  
 
 Post subject: Re: "Could not determine type"-Problem with embedded key
PostPosted: Sun Apr 11, 2010 9:31 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
The problem was I forgot the @OneToOne annotaion in the BookingID ENtity.

Thanks, Clemens


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

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.