We are using db2 sequence for primary key generation. Session bean gets next sequence number and put it into create method of entity bean. I wonder if it make sense to put this call inside create method and remove pk from parameters list. Please keep in mind that it’s CMP. thx in advance
of course this would be the right approach , what is the use of passing one more parameter from bean to bo man ? and so what if it is cmp , u dont pass the primary key but pass all other things , and then take the key from ur id generator and use it there only. we do the same in our case so enjoy
The minimum requirement for the ejbCreate() method is to make the PK and assign it to the primary key field. You will, however, return null from this method in order to be compliant with the EJB spec.
WARNING! This will NOT work in all CMP implementations! For instance, WebSphere does not support this. Currently there are vendor-specific support for this in some servers, but not in all. This is outside the 2.0 CMP spec, and is not guaranteed to be portable!