Haa Vy Dao and Hrair Karaboyadjian,
It is absolutely not necessary to do it in the same line .
Actually , to find out what happened exactly ,the commit command must be put
in a seperate try-catch block , and the exception caught, and redirected or
thrown appropriately.
For example ,consider this sample method body...
public void doSomething(..) throws SomeAppException{
javax.transaction.UserTransaction ut=ctx.getUserTransaction();
ut.begin();
//Fill in the operation you want in this transaction..
.......
.......
try{
ut.commit();
}catch(Exception commitException){
throw new SomeAppException("Exception in Commit due to
::"+commitException);
}
}
Iam not sure what a ABORTONLY means , but you should get more info if the
exception is caught...
Hope it helps...
Well cheers!!
R...
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Vy Dao
Sent: Tuesday, May 22, 2001 10:17 PM
To: [EMAIL PROTECTED]
Subject: Re: Sample code for transactional EJB
Well to answer to your question
the correct syntax for this is
ejbContext.getUserTransaction().begin();
you must do this on one line only,
--- Hrair Karaboyadjian <[EMAIL PROTECTED]> wrote:
> Hi,
> I want to write a transactional EJB (session and
> entity), I read the J2EE
> Blueprints and try the sample line as mentioned like
> UserTransaction ut =
> ejbContext.getUserTransaction();
> ut.begin();
> // perform transactional work here
> ut.commit();
>
> but it didn't work, I get in the log file of my
> application server this:
>
> May 22 14:18:07 2001: AFLIB Message: 18209/11/0:
> Transaction::Commit():
> Transaction was marked ABORTONLY - Aborting!
>
>
> I don't if this message is correct or something is
> going wrong
>
> thank you if you can help me
>
> Hrair Karaboyadjian
> Software Engineer
>
> DC Soft S.A.L.
> Tel: +961-1-385425
> Fax: +961-1-385428
> P.O.Box 11-337
> Beirut - Lebanon
> email: mailto:[EMAIL PROTECTED]
> http://www.dcsoftintl.com
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff EJB-INTEREST". For general
> help, send email to
> [EMAIL PROTECTED] and include in the body of the
> message "help".
>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".