Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-08-2008, 09:28 AM
Member
 
Join Date: Aug 2008
Posts: 1
zigzag is on a distinguished road
Hibernate mapping error Provided id of the wrong type with composite ID
Hello every one, I try to map two model class by anotation but I caugth this error

Code:
Exception in thread "main" org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class com.datam.xplorer.model.MpausrPK, got class com.datam.xplorer.model.MpuserPK at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
here my class

MpuserPK
Code:
@Embeddable public class MpuserPK implements Serializable { @Column(name = "M0DIVI", nullable = false) private String m0divi; @Column(name = "M0USID", nullable = false) private String m0usid; public MpuserPK() { } //some getter and setter method }
Mpuser
Code:
public class Mpuser implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected MpuserPK mpuserPK; @Column(name = "M0CONO", nullable = false) private short m0cono; @Column(name = "M0USPW", nullable = false) private String m0uspw; @Column(name = "M0USTA", nullable = false) private char m0usta; @Column(name = "M0PICT", nullable = false) private String m0pict; @OneToOne(cascade = CascadeType.ALL, mappedBy = "mpuser",targetEntity=com.datam.xplorer.model.Mpausr.class) private Mpausr mpausr = new Mpausr(); public Mpuser() { } public Mpuser(MpuserPK mpuserPK) { this.mpuserPK = mpuserPK; } //some getter and setter method }
MpausrPK
Code:
@Embeddable public class MpausrPK implements Serializable { @OneToOne @Column(name = "M1DIVI", nullable = false) private String m1divi; @Column(name = "M1USID", nullable = false) private String m1usid; public MpausrPK() { } //some getter and setter method }
Mpausr
Code:
@Entity @Table(name = "MPAUSR", schema="MTHJDTA") public class Mpausr implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected MpausrPK mpausrPK; @Column(name = "M1CONO", nullable = false) private short m1cono; @Column(name = "M1AMIN", nullable = false) private BigDecimal m1amin; @Column(name = "M1AMAX", nullable = false) private BigDecimal m1amax; @Column(name = "M1POSI", nullable = false) private String m1posi; @Column(name = "M1PRIO", nullable = false) private int m1prio; @Column(name = "M1ORT1", nullable = false) private String m1ort1; @Column(name = "M1ORT2", nullable = false) private String m1ort2; @Column(name = "M1ORT3", nullable = false) private String m1ort3; @Column(name = "M1ORT4", nullable = false) private String m1ort4; @Column(name = "M1ORT5", nullable = false) private String m1ort5; @Column(name = "M1ORT6", nullable = false) private String m1ort6; @Column(name = "M1ORT7", nullable = false) private String m1ort7; @Column(name = "M1ORT8", nullable = false) private String m1ort8; @Column(name = "M1ORTY", nullable = false) private char m1orty; @Column(name = "M1STAT", nullable = false) private char m1stat; @Column(name = "M1LEVL", nullable = false) private char m1levl; @JoinColumns({@JoinColumn(name = "M1DIVI", referencedColumnName = "M0DIVI", insertable = false, updatable = false), @JoinColumn(name = "M1USID", referencedColumnName = "M0USID", insertable = false, updatable = false)}) @OneToOne private Mpuser mpuser; public Mpausr() { } public Mpausr(MpausrPK mpausrPK) { this.mpausrPK = mpausrPK; } }
and I can't chage table structure.
please any one help me

Last edited by zigzag : 08-08-2008 at 09:40 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-11-2008, 10:18 PM
Member
 
Join Date: Nov 2008
Posts: 1
lcaffe is on a distinguished road
Same problem.
Dear I get the same problem!
Did you resolve? How?

Best regards,
Leonardo
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate - Mapping files JavaForums Java Blogs 0 08-03-2008 04:41 PM
How to get object from composite-id in Hibernate? ibjava Database 1 05-07-2008 06:05 PM
composite-id problem hibernate javadev Database 13 01-28-2008 10:12 AM
composite key Hibernate Problem Web Frameworks 0 07-25-2007 01:13 PM
composite-id and hibernate Marty Database 1 05-28-2007 06:34 AM


All times are GMT +3. The time now is 02:03 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org