[jboss-user] [EJB 3.0 Users] - Re: Design: When the line between domain objects and service

ttarhan do-not-reply at jboss.com
Tue Sep 29 19:16:52 EDT 2009


Don't read too much into my specific example. I'm trying to illustrate a point. My point is that EJB and JPA force us into a model where our domain objects cannot rely on any container provided services. I fully understand the reasoning behind it. 

However, I'm asking for ideas on elegant ways to deal with this issue. If certain subclasses of an Entity need to do things that weren't necessarily anticipated when the service layer was created, we have to make changes to the service layer to specifically support these things. 

So each time I subclass Mailbox, I have to modify a service method somewhere to deal with that new type of Mailbox, if that new type has any different behavior which may need a container service. This means we completely miss-out on the polymorphism of the Mailbox object.

Seems to go against the whole notion of objects, which combine data and behavior, and more into a combination of data structures and procedural methods.

So, does anyone have any solutions?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257767#4257767

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257767



More information about the jboss-user mailing list