Domain Class and EJB Component

Hi,

I have defined a set of domain classes(with get/set methods) and a set of EJB Session Beans for the business logics.

The question is,where do I locate the domain classes?

Create a package for it (e.g. com.mysystem.domain)?

Or distribute it into the Session Bean packages (e.g. for account related domain classes, place it into com.mysystem.ejb.account)?

The problem for placing it into the domain package:

1. I have too many domain class ( >200). It's hard to maintain and perform analysis. (Imagine >200 classes in a class diagram)

2. All session beans need to import the "com.mysystem.domain" package in order to reference the domain classes. Therefore, all session beans will have the dependency to the domain package. Is it what component based development (CBD) does?

The problem for distribute it into the Session Bean packages:

1. Some domain classes are heavily depends on other domain classes (e.gAddress class has association relationship with theCustomer class andStaff class) If I have a session bean for Staff Management(StaffBean) and Customer Management(CustomerBean), where should I put theAddress class?

1. Some domain classes are abstract classes. e.g.Person abstract class have a generalization relationship with theCustomer class andStaff class. Similiar to point 1, where should I put thePerson class?

It is appreciate if anyone can clear my mind of component design.

[1567 byte] By [vincentjava] at [2007-9-27 14:27:24]
# 1

I have the same confusion, but I think we should place them in a separate packages , a package for each related bundle of domain objects, the logic behind this is that domain object should not know that you are using EJBs or any other technology .

an OO expert advice is appreciated

knasser at 2007-7-5 22:18:22 > top of Java-index,Other Topics,Patterns & OO Design...