| Author |
New to EJBs
|
Lance X. Greenberg
Greenhorn
Joined: Aug 13, 2003
Posts: 1
|
|
|
I need to populate a listbox with all the values from a reference table. I'm not quite sure of the "correct" way to do this with EJBs. Should I have a CMP with a findAll method that is called by a session EJB? The session EJB could then iterate through all of the returned CMP references getting the particular field of interest and bundle them up in a vector or array and return them to the client. I am concerned about this if the findAll returns several hundred CMP references. Is this a problem? Thanks in advance.
|
 |
Karthik Guru
Ranch Hand
Joined: Mar 06, 2001
Posts: 1209
|
|
Originally posted by Lance Greenberg: I am concerned about this if the findAll returns several hundred CMP references. Is this a problem? Thanks in advance.
Your approach is defintely acceptable . Several 100 probably w'd not be an issue. If it's a table with lots of data, then yes. Infact from what i gather (from discussions here) , i have a feelign that , we s'dnt even be mapping an entity bean to such tables. Either way, your solution looks good.
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
|
If you are using the values for read only purpose I suggest you to use simple JDBC rather call finder methods.
|
Groovy
|
 |
Karthik Guru
Ranch Hand
Joined: Mar 06, 2001
Posts: 1209
|
|
|
Infact in most of the applications / screens, data is generally displayed on the UI in a table format. The data is normally picked from 1 / multiple tables. We use a homegrown framework to render such data. It ofcourse has advanced rendering capabilities , has the ability to use a SQL , or any callback methods to generate the data to be rendered. If you can spare some time , and you already dont have one ,try developing one, It c'd be an interesting project and i'm sure it c'd be so easily reused across various projects.
|
 |
Pho Tek
Ranch Hand
Joined: Nov 05, 2000
Posts: 757
|
|
This problem begs the question: how often does data in your drop down change ? If not a lot; you could write something that will query the DB, persist results to a file on disk. Then your drop down is just a load from a text file from the local server. Add some caching for the file, and your form will perform considerably under load. And you're saved from the performance hits of: a) remote call to the db server b) remote call to the EJB container Pho
|
Regards,
Pho
|
 |
 |
|
|
subject: New to EJBs
|
|
|