I am working on a project using hibernate and spring. Hibernate is encapsulated in the DAO layer, and the DAO layer has the appropriate level of service, as well as the controllers that are displayed for queries and JSP pages. I was told not to skip objects between these layers (Controllers β Service β DAO), as these are overhead costs. One specific example: when I needed to update a boolean value in a domain object (ORM class), I wrote a method that passed a domain object between the service level and the DAO level, and I was told to pass the object identifier and a specific boolean value to and write separate methods in layers for this. It is right? I feel that this will invalidate many of the benefits of using the ORM (Hibernate) tool. Am I really not mistaken? Any tips and ideas would be helpful ....
You are 100% right. This is terrible advice. Skip objects. This is exactly what Hibernate is designed for, and the βoverheadβ for the normal transfer of objects is just crazy. If there is something about an application that you do not know, be careful with the advice from the person who told you this.
As with most architecture issues, there is a trade-off.
, (, - , -), , , , DRY (Do not Repeat Yourself), , . , , NHibernate Validator, , -.
, (, -), ORM . ( ), , , .
( ), , : , ( ). , , , (5k XML- ..) . (NB: # 5k !)
-.
-
, 50 , , , . , / .
To answer your question more directly => pass those objects around and not think about performance. You will if you need to later, but it is unlikely that this will be caused by the transfer of objects around.