• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB entity bean or JDBC?

 
Mark Lau
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on my graduation project proposal.

I talked about this with a friend of mine who works in the IT industry.

He said that access to database by EJB entity bean can be very slow, and JDBC performs much better. He says that's why his company does not use EJB at all, they use JDBC to access database. And he also mentioned that they selected JDBC because it supports multithread better and that there will be some multithread problems if we use EJB entity bean.

He said we have a pet store demo application from java.sun.com, which I think most of you know.

So he said that I can run the original pet store demo application, test its performance, record the data, and then change that version of the application by replacing the EJB stuffs there, and run the latter, test its performance, record the data, and then I can make a good comparison between the 2 versions and may get a conclusion such as "EJB entity bean access of database is slower than JDBC".

What do you people think? Is this feasible? And is it optimistic that I'll get anything from such a comparison?

If your answer is yes, I'll start to work on it. At this moment, I think it's interesting.

Thanks a lot.
 
ipog
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your friend is right.
Go ahead. But JDBC where? In the session bean?Which session bean statefull or stateless?
Or is it going to be a BMP entity bean..pls be clear about this!!!
 
jon boydell
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, your friend is correct. Just using JDBC over an EJB is much quicker. This is because EJBs whose persistence layer is a database generally use JDBC to communicate with the database. Thus using JDBC within an EJB (and calling the EJB from a client application) must be slower than just using JDBC (from a client application). However, EJB's are not about database access, they are about distribution, scalability and flexibility. The problem JDBC solves is "how do I access a database?" the problem EJB solves is "how do i distribute my application over multiple servers" or "how can i ensure my components are transaction aware", that sort of thing...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!