ASHWINJM wrote:
> if i want a bean to be part of a transaction, how do i have it access the
> database? can i go ahead and use the usual jdbc calls, avoiding, of course,
> setting the isolation level, and autocommit properties? or does it have to
> be done some other way?
>
> i've hunted around what resources i could find, and i suppose that some of
> them are hinting at this implicitly - i just need some clarification.

Your assumptions are correct.

One thing to be wary of that I've seen is the following:
Connection con = dataSource.getConnection();
tx.begin();
...
tx.commit();
con.close();

which should be in this order instead (to allow correct tx management of
connections:
tx.begin();
Connection con = dataSource.getConnection();
...
con.close();
tx.commit();

/R

--
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
Homepage: http://www-und.ida.liu.se/~ricob684

===========================================================================
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".

Reply via email to