• Post Reply Bookmark Topic Watch Topic
  • New Topic

jdbc code located in pojo or stateless sessio bean?  RSS feed

 
marc dauncey
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I'm new to J2EE and have a question regarding best practice.

I have a DAO which is a regular Java object that queries an Oracle database. On top of this, I have a stateless session bean that caches the DAO and calls its methods. Is this the right design?

I understand that EJBs are optimised and transactions managed by the container, so does it matter if the actual JDBC code is located in another object?

Thanks


Marc
 
Annie Smith
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by marc dauncey:

I have a DAO which is a regular Java object that queries an Oracle database. On top of this, I have a stateless session bean that caches the DAO and calls its methods. Is this the right design?


That should depend on what the session bean is intended for. One of the common reasons for choosing a session bean is this

The use of DAO with session bean is used as a speedier alternative to entity beans.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!