Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrievals - Read Only Entity Bean Vs Customized Retrieval Method  RSS feed

 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need to do a retrieval and no update is going to be done.
To do this, I can use the entity bean findBy method with
a read uncommited isolation specified.

The 2nd option is to have a data access object with
the query method using JDBC.

Both are workable solution.
But which is the better approach ?


Thanks in advance.
 
prem karun gopal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on how big is your data.
If you are talking about retreiving thousands of records don't go
for entity beans.That might create memory issues.
For large retreivals go for DAO.
 
Sandeep Bhagavatula
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Gordon:
Hello,

I need to do a retrieval and no update is going to be done.
To do this, I can use the entity bean findBy method with
a read uncommited isolation specified.

The 2nd option is to have a data access object with
the query method using JDBC.

Both are workable solution.
But which is the better approach ?


Thanks in advance.


Yes. for large read-only operations you should bypass the EJB container and take a direct JDBC route as specified in sun pattern blueprints here http://java.sun.com/blueprints/patterns/FastLaneReader.html
Sandeep Bhagavatula
 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How about if we are just retrieving 1 or 2 rows,
eg: some lookup attributes ?

Can I said that for read-only retrievals, we should
AVOID entity beans and USE DAOs instead.


Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!