Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Will EclipseLink work in a true autocommit environment?

You can customize the DatabaseLogin using a SessionCustomizer specified in
your persistence.xml.  You can access the login from the session
(session.getLogin()).

SessionCustomizer is currently in the (wrong) package
"org.eclipse.persistence.internal.sessions.factories".

It can be set through the persistence.xml property,
"eclipselink.session.customizer".


Tim Hollosy wrote:
> 
> Ok, since I'm creating my connection with the JDBC properties in my
> persistence unit, the only way I could think to get at the
> DatabaseLogin was getting it from my session in my EM before I start
> it, however calling em.begin() still causes it to create a transaction
> on the database, I guess i'll have to dig in to the code a bit more.
> 
> This really isn't a show stopper for me, but I'd be interested if it's
> possible.
> 
> Thanks
> 
> 
> On Wed, May 14, 2008 at 9:36 AM, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
>> Thanks, we'll try this out and yes it is an odd design choice I admit.
>> But the world of fat clients is odd! It's a decision that has to be
>> made, the trade off between each client holding it's own connection
>> pool or all of them sharing a set of transactionless connections on a
>> proxy.
>>
>> Really we get around it by manually controlling when things hit the
>> database with the flush type on commit.
>>
>> What I mean by work, is will I still be able to use a UnitOfWork with
>> begin/commit/rollback statements without actually using my database's
>> (postgres) transactions.
>>
>> I don't really see how to use this DatabaseLogin class though, after
>> construction what class consumes it?
>>
>> Thanks,
>> Tim
>>
>> On Wed, May 14, 2008 at 9:16 AM, James Sutherland <jamesssss@xxxxxxxxx>
>> wrote:
>>>
>>> Not sure what you mean by "work".  EclipseLink will begin and commit
>>> transactions where required.  If your database does not support
>>> transactions
>>> then (if it silently ignores JDBC commit()) you will just not get any
>>> transaction semantics.  If it throws an error on JDBC commit() then it
>>> will
>>> not work, you could disable EclipseLink from processing transactions
>>> (DatabaseLogin.setUsesExternalTransactionController(true)), but it would
>>> seem to be an odd design choice to be using a database configuration
>>> that
>>> does not support transactions.
>>>
>>> MySQL does support transactions.
>>>
>>>
>>> Tim Hollosy wrote:
>>>>
>>>> I'm using EclipseLink with a non jta datasource, due to some weird
>>>> proxy stuff I have to stay in autocommit mode. I thought that was
>>>> working fine, but now that we're in heavier test mode I see that
>>>> EclipseLink is turning autocommit off when beginning a transaction,
>>>> and back on again after a commit.
>>>>
>>>> I thought that EclipseLink's transactions were independent of the
>>>> database, but apparently I was mistaken.
>>>>
>>>> So my question is, is it possible for EclipseLink to work in a true
>>>> autocommit environment? I assumed it would because it works with mysql
>>>> (we're in postgres behind a proxy, and our proxy version doesn't
>>>> support transactions).
>>>>
>>>> --
>>>> ./tch
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Will-EclipseLink-work-in-a-true-autocommit-environment--tp17217289p17252754.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top