Hi baqar, yes, you should have this delegate layer, it is called a business delegate design pattern, it abstracts the caller from underlying logic of retrieving a connection to whatever the business tier might be, be it ejb 3, 2.1 or spring. The idea is also to allow any caller a standard way of accessing business objects, be it browser client, handphone based client so on and so forth.
With thanks, Chin Boon. Sent via BlackBerry -----Original Message----- From: Baqar Naqvi <baqar_gr...@hotmail.com> Sender: java-ee-j2ee-programming-with-passion@googlegroups.com Date: Mon, 4 Jul 2011 08:22:02 To: <java-ee-j2ee-programming-with-passion@googlegroups.com> Reply-To: baqar_gr...@hotmail.com Subject: [java ee programming] Delegate and DAO layers with EJB 3.0 We are designing a simple web application, and have decided to use EJB 3.0 in it. We will use JPA for persistence with the session facade patterns. As I cannot discuss the application's business I have mentioned the relevant patterns that are being used. Given this I am trying to figure out the usefulness of having a Delegate layer to invoke the session beans. Since resource injection (using annotations) will only work if the calls are made from container managed classes/components, it will cannot be used if I use a delegate layer. In the past this layer has been used for JNDI lookups and exception handling. Do we still need this layer ? If yes, what could be the benefits of having it. A similar situation arises when we consider using the DAO layer. The annotations on the methods controlling the transactions will only work on the Entity class not on the DAO class. Again should we have a DAO layer, but if we do we will not be able to use annotations. Also if we ignore the DAO layer both the mapping to the database and the different queries will be cluttered in this class. So, given this what will be a better option to avoid using annotations and have a DAO layer or avoid a DAO layer? I am also open to other alternatives regarding these two layer. Looking forward to your responses. Thanks,Baqar -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en