[jboss-dev-forums] [Design of JBoss Identity] - API Model - Plain pojos or not...
bdaw
do-not-reply at jboss.com
Mon Oct 27 06:03:01 EDT 2008
Some of ideas discussed in the other topic (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=144427) ends up in a more general question on how API model objects should be designed/implemented.
Should the Identity/Group/Role objects be plain pojos or expose some of management operations.
1) Plain POJOs - Identity/Group/Role objects keep minimal information about Id/Name/Type. They are easily seriazible and there are no problems with closed session (like with detached hibernate entities). With this approach even getDescription method should be removed as it needs a session reference to retrieve the value.
2) Model objects keep reference to the associated session and expose some of management operations like
Group.associateGroup(Group group)
| Group.associateIdentity(Identity identity)
The idea is to keep all methods in the managers but duplicate some of them in Identity/Group/Role interfaces to expose convenient use:
| employeeGroup.associateIdentity(jackBlack)
|
| and
|
| identitySession.getRelationshipManager().associateIdentity(employeeGroup, jackBlack)
|
Both approaches have pros and cons.... With the second approach serialization requirements can be painful and we may end up with things like SessionClosedException...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184784#4184784
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184784
More information about the jboss-dev-forums
mailing list