Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.357 :

Posted: Fri Apr 15, 2011 3:24 am
by ETS User
From the code displayed in the page my understanding is that the XLocal bean is Remote, while the answer claims it is local.

Re: About Question enthuware.oce-ejbd.v6.2.357 :

Posted: Fri Apr 15, 2011 6:13 am
by admin
@Remote has been changed to @Local
Thanks for reporting.
BTW, we sincerely appreciate you reporting the mistakes here but if you sign up (or report them by email), we can track your reports and refund your order.
-Paul

Re: About Question enthuware.oce-ejbd.v6.2.357 :

Posted: Thu Dec 06, 2012 1:55 pm
by rion
I have doubts about correctness of the answer. The value variable of public class Data is declered private so this variable should be accesible in XBean class only trought public getter and setter. Because of the lack of response 'compilation exception' I chose 'The value cannot be determined.'

Please correct me if I am wrong

Code: Select all

public class Data {
  [b]private [/b]int value = 0; //private declaration
  //public getter and setter for value
}

@Local
public interface XLocal{
   void processData(Data d);
}


@Stateless
public class XBean implements XLocal{
  
    //... other business methods  
   public void processData(Data d){
      [b]d.value[/b] = 20; //invalid access
   }
}

@Stateless
@Local(YLocal.class)
public class YBean {
  
  @EJB
  XLocal xbean;

  public void businessMethodY(){
     Data d = new Data();
     d.setValue(10);
     xbean.processData(d);
     System.out.println(d.getValue());  // <-------- LINE 100
  }

}

Re: About Question enthuware.oce-ejbd.v6.2.357 :

Posted: Sun Dec 16, 2012 8:07 am
by admin
You are right. This has been changed to use the setter now.

thank you for your feedback!