on 03-29-2006 10:49 AM
Hello,
I have read the available "How To", Using EJBs in Web Dynpro Applications where the author mentions that one should use a Command Bean (according to J2EE Design Patterns) so that one can invoke business methods in a Session Bean from our Web Dynpro Application. Well, although, I have read some available articles in the internet about J2EE design patterns, I still have some questions about command beans and its usage in Web Dynpro applications.
I have developed a WD App which uses EJBs to read data from the DB.
Let's suppose I only have two tables: BOOKS and AUTHORS.
Lets also suppose I have to Entity Beans (one for each table) and a Session Bean with two methods: Book[] getAllBooks() and Author[] getAllAuthors();
I also have a Command Bean which I imported in my WD App.
My questions are:
How should I design my Command Bean?
Can I have only one Command Bean with two methods each calling one of the methods of the Session Bean?
Or instead should I design two Command Beans, one for each call?
In the last case do the methods must be named <b>execute</b> or can I name them whatever I want?
Furthermore, how should I store the data in my command bean? In instance variables?
If so, can I use array of a class representing a record in the database table (for instance, classes Book and Author) or do I have to store the data in a generic collection (such as ArrayList for instance)?
I ask this last question because if I try to store the data in an array when I am importing the Command Bean as a JavaBean model I always get an error.
One last question: Can the Command Bean execute method directly return the data or should I always store the data in an instance variable an then get it using getter methods?
I know this questions are more about J2EE Design Patterns and JavaBeans specification than they are about Web Dynpro but I also have doubts about the rules that the command bean must obey in order to accomplish a successful JavaBean model import in WD.
Some guidance or tips would be highly appreciated.
King Regards
I have the same problem.
Does anyone know the solution?
Thanks
Davide
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have the same confusing...
who can help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anyone?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.