-->
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: Problem with Embeddable
PostPosted: Tue Aug 07, 2007 10:01 am 
Newbie

Joined: Thu Jun 14, 2007 8:10 am
Posts: 7
Hi,

I have a problem, I don't know exactly if it's a hibernate or a spring problem:

I have 2 tables:
FirstTable
  • FirstTablePK(PK)
  • Name
SecondTable
  • FirstTablePK(FK)(PK)
  • SecondTablePK(PK)
  • Name


and 2 classes to map the tables:

Class1:
Code:
@Entity
@Table(name="FirstTable")
public class FirstClass implements Serializable{
   @Id
   @Column(name="FirstTablePK")
   @Type(type="integer")
   private Integer id;

   @Column(name="Name")
   @Type(type="string")
   private String name;
}

Class2:
Code:
@Entity
@Table(name="SecondTable)
public class SecondClass implements Serializable{
   @Id
   private SecondTablePK id;

   @Column(name="Name")
   @Type(type="string")
   private String name;

   @Embeddable
   public class SecondTablePK implements Serializable{
      public SecondTablePK(){}
      @Column(name="SecondTablePK")
      private Integer id;
      @ManyToOne
      @JoinColumn(name="FirstTablePK")
      private FirstClass firstClassImpl.
   }
}


When I try to run this I get the following exception:
Quote:
org.springframework.orm.hibernate3.HibernateSystemException: SecondClass$SecondTablePK; nested exception is org.hibernate.InstantiationException: No default constructor for entity: SecondClass$SecondTablePK

although I have a default constructor....

Any ideas...?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 4:14 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Try to instantiate that class yourself :)

http://www.brpreiss.com/books/opus5/html/page602.html

Cheers,

Chris

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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.