• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to EJBs

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using the values for read only purpose I suggest you to use simple JDBC rather call finder methods.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic