Originally posted by John Todd:
we should a CMP field called team in PlayerBean and create setter and getter methods for this CMP field.
You've done that (partially) already: setTeamLocal(TeamLocal)
is that accessor. And with CMP/CMR, you only declare abstract accessors -- not the member fields to hold their values.
With regard to data objects (e.g. PlayerDO), you can create helper classes that will create DOs from your entity beans, and this is what the article was getting at, I believe. I took a short-cut and added DTO-creation methods to my entity beans directly: getAllFieldsDTO and getWholeTreeDTO. As the second method's name implies, my solution is quite inflexible, but it was quick to implement and works.
Realize that PlayerLocal.getTeam (getTeamLocal in your case) returns the entity bean's interface, which you don't want to put directly into your DO. Your code would look more like this: