-->
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.  [ 4 posts ] 
Author Message
 Post subject: Embedded object and Embeddable class
PostPosted: Wed Dec 19, 2007 6:53 am 
Newbie

Joined: Thu Aug 23, 2007 11:59 am
Posts: 10
Hello, is it possible using this mapping?
An embeddable class B inside class A.

Code:
@Entity
public Class A{

public A(){
b = new B();
}

...
@Embedded
private B b;
..

public B getB(){
..
}
public void setB(B b){
..
}

   @Embeddable
   Class B{
             String c;
              ..
      public String getC() {
         return c;
      }
      public void setC(String c) {
         this.c= c;
      }
               ..
   }
..

}//close class A


I receive the exception
No default constructor for entity: com.terun.A$B

If I put the class B outside A, I don't receive exception but in my jsp, I can't put ${a.b.c} (where a is an instance of class A).

It seems that not read the method "getC()".

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 8:15 am 
Beginner
Beginner

Joined: Tue Nov 27, 2007 9:44 am
Posts: 46
Hi,

have you tried adding an empty constructor to Class B?

Code:
public B(){
}



Regards,
Frank


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 5:30 am 
Newbie

Joined: Thu Aug 23, 2007 11:59 am
Posts: 10
Yes, I try this, but obtain the same error!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 6:44 am 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
You may have to make your embedded class static so it can be instantiated independently of the enclosing class.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.