-->
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: MappingException using composite primary key
PostPosted: Tue Dec 28, 2010 2:31 pm 
Newbie

Joined: Tue Dec 28, 2010 1:59 pm
Posts: 1
Hi,

it's my first day using hibernate and i got the first problem. I hope to find some help here. I've got a class Belegung

Code:
@Entity
@Table(name="BELEGUNG")

public class Belegung implements Serializable {

...

@EmbeddedId private BelegungId belegungId;

...

}
which defines and EmbeddedId called belegungId. The id object contains two other objects also entities. But i just need the primary keys of these entities otherwise java throws a mapping exception. Have anybody a idea how can solve these problem with a jpa annotaion for my fields. I've tried this:

Code:
@Embeddable
public class BelegungId implements Serializable {

    /* The entity Veranstaltung */
    @JoinColumn(name="VERNR", referencedColumnName="VERNR")
    private Veranstaltung veranstaltung;
    /* The entity Student */
    @JoinColumn(name="MATRNR", referencedColumnName="MATRNR")
    private Student student;


But it didn't work. It seems to me that i got the whole entities instead of the attributes.
I hope somebody can help me.

Thanks a lot.


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.