- status: open --> closed-out-of-date
When a cmp bean is retrieved by a finder method it does
not set the isCreated property on to true.
my case :
I have a cmr set in a post create with a bean retrieved in
this way :
in UserEJB :
public void ejbPostCreate(....) {
Collection roles = getRoles();
roles.clear();
RoleEJBLocal role = roleHome.findByRoleAndRoleGroup
("authenticated", "Roles"); // custom EJBQL finder
roles.add(role);
}
roles.add(role); throw an exception (cmr field can't be
set in ejbCreate, etc...) because the cmp engine see
the isCreated property to false in
JDBCCMRFieldBridge.addRelation(...)
isCreated value is set to true when a bean is
created or loaded but the finder does not call the
loadEntity on JDBCStoreManager at all.
What I did to make ot work is to force the engine
to load the bean with an access to a cmp field :
RoleEJBLocal role = ... // custom EJBQL finder
**role.getName(); ** // load the instance
roles.add(role);