As I say to you before, two bad things:

1) Your LectureEntity bean has a cmp field named questions, and a cmr field named also 
questions. Remove the tags I indicate before:

  | @ejb:persistent-field 
  | @jboss:column-name name="questions"
  | 
or rename one of them (cmp or cmr) and put the appropriate getter and setter.

2) The QuestionEntity (addQuestion parameter) is a remote interface. You cannot set a 
cmr field with a remote interface (only a local). For that, you have two solutions:
2.1 : retrieve a local interface from your client if you can and change your method:

  | public void addQuestion(QuestionEntityLocal question) { 
  | this.getQuestions().add(question); 
  | } 
  | 

2.2 : if you can't, just pass the primary key and retrieve a local interface in the 
method:
Add an ejb-ref to your bean:

  |  * @ejb.ejb-ref
  |  *   ejb-name="QuestionEntity"
  |  *   view-type="local"
  | 
Then in your method:

  | public void addQuestion(Long questionId) { 
  | try {
  |     javax.naming.Context ic = new InitialContext();
  |     Object obj = ic.lookup(<Your Question bean JNDI name>);
  |     // Something like "java:comp/env/ejb/QuestionEntityLocal"
  |     QuestionEntityLocalHome Home = 
(QuestionEntityLocalHome)PortableRemoteObject.narrow(obj,QuestionEntityLocalHome.class);
 
  |     QuestionEntityLocal question = Home.findByPrimaryKey(questionId);
  |     this.getQuestions().add(question); 
  | } catch(Exception e) {
  |     // Error handling
  | }
  | } 
  | 


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836847#3836847

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836847



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to