Hi !
I use Stateful Session bean and BMP entity bean for my system. I have 60 columns in a table which I have to retrieve (from the table) and update (to the table) with the user entered value for all the columns. I use JSP as my client. My system architecture is JSP client calls session bean which inturn calls entity bean for getting and setting the data. I've created a wrapper class with 60 attributes (corresponds to 60 columns of the table) and a constructor with 60 parameters, instead of having 60 setters and getters.
I have some questions regarding this :
1. Initially when the user logs in, he gets the value of the 60 columns data populated in the textfield. To do this, I've planned to call a method in a session bean, which inturn calls entity bean business method. In entity bean, I execute a query and instantiate the wrapper class with 60 column values of the retrieved record (query retrieves only one record) and finally returning the object itself as a whole. Is it a right approach, or if any better approach, pl let me know asap.
2. For setting the values of the attributes (and updating to the table finally) with user entered values, how to do it.
Thanx
AJP
-
EJB best practices (4 messages)
- Posted by: A JP
- Posted on: December 27 2000 19:11 EST
Threaded Messages (4)
- EJB by The eMonkey on December 27 2000 19:54 EST
- EJB by A JP on December 27 2000 20:36 EST
- Wrapper Class by James Killick on December 29 2000 07:12 EST
- EJB by A JP on December 27 2000 20:36 EST
- EJB best practices by vj d on December 29 2000 13:33 EST
-
EJB[ Go to top ]
- Posted by: The eMonkey
- Posted on: December 27 2000 19:54 EST
- in response to A JP
The way that you have suggested your ejb implementation is the current way that we have implemented our e-commerce solution in. It gives the advantage of having the data cached rather than doing an ejbStore and ejbLoad every time that any piece of the data changes. So on that front it is a good design.
I would like to question your table with 60 columns in it. This seems a little large - perhaps some normalisation is in order?
For setting and getting the values to and from the database - this would be done with normal SQL eg INSERT INTO .... and UPDATE ... SET ... etc. Hope this is detailed enough for you :-) -
EJB[ Go to top ]
- Posted by: A JP
- Posted on: December 27 2000 20:36 EST
- in response to The eMonkey
Hi !
Thanks for ur response. Could u tell me "in detail" about the two questions.
AJP -
Wrapper Class[ Go to top ]
- Posted by: James Killick
- Posted on: December 29 2000 07:12 EST
- in response to A JP
AJP
Am I right in assuming that the wrapper class you mention is not an EJB, just a regular java class? Could anybody tell me what the implications of this are? (i.e portability etc.)
AJP I am curious as to how you will guarantee data integrity - what happens if a concurrent client graps the same data? Is this a problem in your application?
Regards
James -
EJB best practices[ Go to top ]
- Posted by: vj d
- Posted on: December 29 2000 13:33 EST
- in response to A JP
It might be useful for you if you take a look at this article...
http://www.javaworld.com/javaworld/jw-12-2000/jw-1208-clones.html
bye,
vijay