Obvious design flaws in the EJB3

I have a domain object called VehicleRecordthat is a sleep object. CRUD operations on these VehicleRecords are processed through an object access object implemented as a non-bean session.

@Local
interface VehicleRecordEao {
    void add(VehicleRecord record);
    List<VehicleRecord> findAll();
    ...
}

@Stateless
class HibernateVehicleRecordEaoBean implements VehicleRecordEao { ... }

From a business level perspective, deleting and adding these records is more than just a CRUD operation. For example, there may be registration and security requirements. To provide these operations for customers, beans sessions are created at the business level.

@Local
interface VehicleRecordManager {
    void createVehicleRecord(VehicleRecord record);
    List<VehicleRecord> 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
    }
    ...
}

Controllers work between the presentation layer and the above business layer to get the job done, conversion between presentation objects (e.g. forms) and objects as needed.

- (). "", , EJB- , , . EJB, OO, "" "" "", .

beans , , ? beans? Eao - beans ?

, , .

+3
5

. , , Anemic Domain Model "". - , OO-, DO. . , , , , .. . n-, "" - , EE .

+4

. , ? -? , ?

, ADM, "" "OO" . ( , , ) User , .

(, ) DAO-, OO. - OO. , , (, EntityManager JPA), (, / ) ..

"" , "Slim" . , , .

+4

, , - . , :

" - - - , "

- EJB, Entity, - , , - , 2 EAO Manager. , , EJB/ Bean VehicleRecord Entity, "VehicleRecordEAO" "VehicleRecordManager" "VehicleRecordAccess" - .

, EAO/DAO/Access getter/setter - . "" , - "".

, , Facade Pattern - - () VehicleRecordFacade VehicleRecordFacadeBean.

Facade, .

+1

- (). "",

.

. . , "VehicleRecordManager", , , .

, VehicleRecord

Java, "VehicleService" ( "VehicleManager" ), ! , , . , , , . ( )

+1

Does it VehicleDaoeliminate part of the smell? A simple change, but it clearly indicates problems with data access.

0
source

All Articles