I have a create method in my Entity bean(BMP)the table has 20 columns.
In order to make the method clean I can think of two options.
1.) I can create a custom class and make it serializable.
This class can then be initialized by the client
and the client can then use it as an argument in
2.) I can create a hash table and pass this as an argument
in my create method. The client can use the hash table
and populate the all the values required by the create
Which of the above two alternatives is better??
I think the paradigm for EJB creation, updating, retrieval, etc... is to use some type of DataBean that maps to your EntityBean. For instance, if you had a EventBean that map to a table called tbl_events that had 20 columns, you would create a corresponding data bean named EventData that had getters/setters for all viewable columns in your tbl_events table. This seems to be a better design as a EventData object represents a something (An event), as a Hashtable is more or less a collection of key/value pairs.
Hope this helps...
Look at the 'Details Object' pattern posted on this site in the Patterns section by Floyd.
hi, u can use hashtable instead of ur own class bcuz if u have ur own class then it has to be present in the client side (java client appln) as well as the serverside.
If u have lot more things like this ur client will become bulky..so better use Hashtable to avoid this situation.