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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

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

Post 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.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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
If you like our products and services, please help us by posting your review here.

rion
Posts: 2
Joined: Thu Dec 06, 2012 1:36 pm
Contact:

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

Post 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
  }

}

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. This has been changed to use the setter now.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests