A basic design question. Say i have a Customer Entity object. There is a corresposnding Customer value object which will be used by the UI layer for display. Now when i create a customer thro' the jsp, i will be creating a Customer value object and then send it across to the server layer to save it. Where is the primary key for the Entiy bean generated? on the UI layer / server layer? What is the general practice. if it is on the server layer, i will end up creating a Customer value object which does'nt have an id. is that ok? In all other cases of modify / update, the UI layer will obviously have an id to deal with upfront. Somebody in our team says that is a practice to generate keys on UI?? something am not aware of but please comment thanx!
If you are using a Value Object for display purpose I assume that it is a read only object created by the Customer bean. So the client has to specifically create it initially. If you are talking of an updatable Value Object even then the creation of the bean is where the primary key will have to be created. Hope this helps.
HI You should also be aware that primary keys can be generated automatically by WLS by using the appropriate tags in your Deployment Descriptor. Since a PK is something only your database should be aware of - and if you're using CMP, then the container would create the PK at the time of initial insertion of the row in the db. The primary key can be a sequence number generated by your database - you decide when you're doing your design which works better for you. Cheers, Chana