Note that there are some explanatory texts on larger screens.

plurals
  1. POObvious flaws in my EJB3 design
    primarykey
    data
    text
    <p>I have a domain object called <code>VehicleRecord</code> which is a hibernate entity. CRUD operations on these VehicleRecords are handled through an entity access object implemented as a stateless session bean interface</p> <pre><code>@Local interface VehicleRecordEao { void add(VehicleRecord record); List&lt;VehicleRecord&gt; findAll(); ... } @Stateless class HibernateVehicleRecordEaoBean implements VehicleRecordEao { ... } </code></pre> <p>From a business layer perspective removing and adding these records is more than just a CRUD operation. There may be logging and security requirements for example. To provide these operations to clients sessions beans are created in a business layer.</p> <pre><code>@Local interface VehicleRecordManager { void createVehicleRecord(VehicleRecord record); List&lt;VehicleRecord&gt; findAll(String make, String model); ... } @Stateless class VehicleRecordManagerBean { public void createVehicleRecordManager(VehicleRecord record) { //business rules such as logging, security, // perhaps a required web service interaction //add the new record with the Eao bean } ... } </code></pre> <p>Controllers work between the presentation layer and the above business layer to get work done, converting between presentation objects (like forms) and entities as necessary.</p> <p>Something here is not right (smells). I have a class called Manager which has got to be a red flag, but several examples in EJB books actually suggest this kind of high level class and tend to use the name manager themselves. I am new to EJB design but in OO design making high level classes called Manager or Handler or Utility screams of procedural and requires one to rethink their design.</p> <p>Are these procedural-utility-class session beans the normal pattern, or is bad to organize your session by a bunch of methods related only to the entity they operate on? Are there any naming conventions for session beans? Should the Eao's and business session beans work at the same layer?</p> <p>If there is a less smelly alternative to this pattern I would love to know, thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload