Hi,
I am relatively new to EJB technology. I have 2 entity beans Employee and Department. I need to display a list of departments in the 'Employee Add' page. Should i populate the list using 'Department' entity beans (one bean for every list entry) or using a select query in a session bean ? What is the standard approach for populating such lists?
srividhya
-
List/combobox population - to use entity bean or not? (2 messages)
- Posted by: Srividhya Narayanan
- Posted on: December 11 2000 16:19 EST
Threaded Messages (2)
- List/combobox population - to use entity bean or not? by Kapil Israni on December 11 2000 16:57 EST
- List/combobox population - to use entity bean or not? by Krish k on December 14 2000 00:42 EST
-
List/combobox population - to use entity bean or not?[ Go to top ]
- Posted by: Kapil Israni
- Posted on: December 11 2000 16:57 EST
- in response to Srividhya Narayanan
hi sri,
well the best wud be too let ur session bean either return a jdbc resultset or a string array department.
u can also create a data structure(java class) to represent ur department. for eg a java class "Department" with code,description as attributes and then getters and setters for those attributes. and then ur session bean method cud return a array of Department objects. but do remember to make this class serializable. because if ur client-session bean method call is over the network, then u will be making network for each piece of data u try to fetch.
u also mentioned entity beans well thats an option too. but if u have 100 dept then imagine u will be asking ur application server to manage 100 instances of entity beans. also entity beans always travel by reference , so take into consideration the amount of network trips.
hope this helps
lemme know
kapil -
List/combobox population - to use entity bean or not?[ Go to top ]
- Posted by: Krish k
- Posted on: December 14 2000 00:42 EST
- in response to Srividhya Narayanan
Some more ideas.
1) If you are using a JSP page u could create a database connection and populate using the resultset object.
2) You can use a servlet to retrieve data and the result can be published as a page for the user.