Hi,

> In the entity bean you have the data logic, in the session bean you have
> the business logic. You use the session bean to interact with the user.
> An example:
>
> SB: CourseEnrollment
> EB: Student, Enrollment, Course
>
> SessionBean have following methods:
> * enroll(studentId, courseId)

I understand this, but this does not answer my question :-)

The problem is this: even if the session bean contains the business logic and
thereby changes the data, the client sometimes needs to see the data (e.g. in
order to present it to the user). Now, how does the data get from the entity
bean to the client? This could be done using bulk accessor objects (=value
objects), like this:

  public class CustomerValue {
    String fistName;
    Date birthDate;
  }
  ---
  CustomerValueObject value = customerSession.getCustomerValue("some Customer
ID");

However, if the entities to be dealt with are complex, this is not very
reasonable. Imagine an entity defined like this:

  EntityA = {
    EntityA parent;  // this produces a tree-like structure
    EntityB[] someEntitiesOfTypeB;
  }

I cannot use value objects to model this kind of entity, because if I did I
would have to fill the 'someEntitiesOfTypeB' array as well as the 'parent'
reference, which in turn will have some references to its own
parent.someEntitiesOfTypeB and so on, which would yield a huge structure.
However, in most cases I do not at all need to access the whole hierarchy of
objects, so this is a gigantic waste of resources.

If I cannot use value objects to access the entities, how should I query my
data? For example, how could a client retrieve the someEntitiesOfTypeB vector
of a given entity?

thx
Heiko

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to