Although it's well specified in the HF that an EB class SHOULD declare also business methods in order to get/set persistent field values (the given reason was - encapsulation), I don't understand why. I mean, if the getters/setters method would have logic (i.e. for validation) I would agree in declaring custom business methods to access/set persistent fields value, but otherwise I can't see why IT'S a BAD IDEA to have only public abstact getters and setters.
Well I think it is the same case as Instance variables. We all know that we are supposed to mark our instance variables
private (which means its transparent to other classes), and have getters and setters to access them. Thus, they are forced to go through getters and setters. We sure could have made it public and have no getters and setters, but now, you have no clue what values the instance variable might get.
Now, suppose the virtual field as follow:
public abstract void setLast (
String last);
If we just exposed this to our client, how can we make a restriction to only allow the client to setLast is from "M-Z"
By using setters, we could have achieved this. Even if we don't have any restrictions to our setters, we should always have getters/setters for the same reason as instance variables. (Hope that example didnt violate any of
EJB Spec

)