I need the following clarifications regarding entity beans
we have an Message driven bean which reads some data from a single database table when message arrives. My question is whether we should use entity beans or direct JDBC calls for ths kind of database lookup
We have a multithreaded java application where each thread looksup two database tables. Is it advidble to model database lookup as entity bean or simple database class.
I would appreciate if some one can help me out.
Thanks in advance,
The answer to this question relies entirely on the nature of the data you are retrieving.
Are you retrieving data that represents a persistent chunk of data that, when logically grouped together, is really an entity that should implement some type of business logic? Will you be treating each "row" of your retrieved records as if it were its own living, breathing object? If so, then the obvious answer would be: Yes; EJB is the way to go.
However, if you are simply retrieving a count, sum, or some other type of aggregate statistic from the database, then definitely not. There are obviously other cases which would lend themselves better to a simple JDBC call or two, but this educated determination is best made by yourself.
In general, EJBs are much cleaner and prettier, but sometimes it just isn't appropriate.