Hi there! Recently we've been moving our architeture. We're slowly moving from Entity beans to hibernate.
- Posted by: Vinicius Carvalho
- Posted on: October 04 2004 19:14 EDT
Also, we're a taking away all the business rules from our facades (finally, they accepted this).
We decided to use Application Service using a command approach instead of a Strategy or COR.
Well, as we still have some entities here, we got our selves in a dilema, creating a command for each CRUD operation of a entity bean, would generate too many commands per application.
Is there any good solution for this? Or is this a normal drawback by the command implementation in this scenario?
Oh, and by the way, as we're movin forward to Hibernate approach, I decided to ban the DTOs and use javabeans instead, even with the entities, as later when the change happens would be easy to handle it. Any comments about this idea?
That sounds just dandy, with the command pattern too many commands can be an issue. What you might consider is producing a class of command which is can be reused. e.g. Update commands take a certain format and perhaps reflecting the update data out of a standard bean which adhears to some kind of pattern?
With regards to Hibernate it is good practice not to expose hibernate objects to the rest of your system. We've found that you often want to tweak your hibernate objects to represent schema changes but that the DTOs can have cleaner object models. If you don't have DTOs then you have to update your application after schema changes. We do hql->hibernate beans->DAO->DTOs->Rest of Application.
Update commands take a certain format and perhaps reflecting the update data out of a standard bean which adhears to some kind of pattern?xSorry, didn't follow your idea, could you post an example?
I thought in having an EntityCommand which would implement Command interface, and add 2 new methods one to find the Home object, and another to populate a Local object given a certain dto. Then I'd have CRUD commands who would extend this class and execute the given operation. Even though I'm still concerned with the number of commands, maybe another pattern would help me.