I actually tested that theory by throwing a CreateException in my ejbPostCreate() and there was a record in the DB for the same AlertId, but did not have the userId and the rest of the data in the row. Hence an orphan record.
--- Thanks Mick Knutson http://www.baselogic.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 15, 2003 6:37 AM Subject: RE: [Xdoclet-user] ejbCreate for an EJB with CMR issues > The entire 'create' process is in a transaction. If postCreate fails, the > entire create will be rolled back. > > > -----Original Message----- > > From: Mick Knutson [mailto:[EMAIL PROTECTED] > > Sent: Sunday, September 14, 2003 10:55 AM > > To: XDoclet > > Subject: [Xdoclet-user] ejbCreate for an EJB with CMR issues > > > > > > I have an EJB with a CMR. I keep getting errors about not > > being able to set > > CMR fields in the ejbCreate() and must do it in the ejbPostCreate(). > > So I did that: > > > > public java.lang.String ejbCreate( AlertDto pAlertDto ) > > throws javax.ejb.EJBException, javax.ejb.CreateException > > { > > setAlertId( pAlertDto.getAlertId() ); > > setUserId( pAlertDto.getUserId() ); > > //setAlertDto( pAlertDto ); > > > > return null; > > } > > > > public void ejbPostCreate( AlertDto pAlertDto ) > > { > > /* > > Update the EJB as the CMR information cannot be set > > at create time: > > java.lang.IllegalStateException: A CMR field cannot be set in > > ejbCreate; > > this should be done in the ejbPostCreate method > > instead [EJB 2.0 > > Spec. 10.5.2]. > > */ > > setAlertDto( pAlertDto ); > > } > > > > > > But my issue is about the setUserId(). I do not want to > > create this EJB if > > the userId does _not_ get set. If so, I will have orphan data > > with no way to > > access it. > > > > So, do I need to set certain transaction types for the ejbCreate() and > > ejbPostCreate() to ensure that the entire create/postCreate > > completes or > > rolls-back? > > > > --- > > Thanks > > Mick Knutson > > http://www.baselogic.com > > > > +001(805) 563-0666 Office > > +001 (708) 570-2772 Fax > > --- > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > xdoclet-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user