-
1. Re: to pass a pk value to ejbCreate or not to pass?
takenori Aug 30, 2003 3:42 AM (in response to maciek)Hi,
We're using auto-increment feature
so that we don't need to pass the pk value
in ejbCreate method.
Takenori -
2. Re: to pass a pk value to ejbCreate or not to pass?
maciek Aug 30, 2003 4:20 AM (in response to maciek)ok
So let's narrow my xample to the situation where I decided to use some stateless session bean to generate pk's.
(Is such a method used by you?)
then again should that session bean method getNextPk be invoked by cmp in its create method or pk_generation-session bean should be invoked earlier by a service session bean that is responsble for "adding rows" action?
regards -
3. Re: to pass a pk value to ejbCreate or not to pass?
kv_moj Sep 1, 2003 2:28 AM (in response to maciek)Hi,
I use Autonumber factory for auto-increment (just to keep things portable).
I enter ejbCreate() with no pk and call the factory.getNextInteger() in that method.
This works fine. So I imagine you can do the same with your session bean.
The rule is that before you leave ejbCreate you should have set your pk and no other fields (eg. setPk(sessionBean.getNextInteger())). If you need to set any other fields then you should set them in ejbPostCreate().
kv. -
4. Re: to pass a pk value to ejbCreate or not to pass?
maciek Sep 1, 2003 5:13 AM (in response to maciek)thanks, but one more equestion about that in ejbCreate only pk field should be set
(actually i recenlty read that in ejbPostCreate one should set CMR fields in ejbPostCreate not in ejbCreate)
you said that in ejbCreate only pk field
why not everything just in ejbCreate? is it a mater of style?
(maybe I am asking about something obvious :)
thanks
maciek zywno