Re: PGXADataSource does not implement DataSource

From: "Bill Middleton" <utvikler(at)gmail(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, books(at)ejurka(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PGXADataSource does not implement DataSource
Date: 2007-04-20 20:56:41
Message-ID: 4efe54510704201356i7f5c1d51i9b73b2e186c81b31@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello again, and thanks for the feedback. Yes, I'm likely in way over my
head here. However, things are working acceptably with minimal testing so
far. I register my modified PGXA as the resource in a
UserTransactionService and then pass it into hibernate via jndi lookup,
along with a transactionmanager. The interesting bits of
hibernate.cfg.xmlare then:

<property name="hibernate.dialect">
org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.datasource
">java:comp:myDS</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory</property>

Hibernate accesses the DS in
org.hibernate.connection.DataSourceConnectionProvider

I'm using the atomikos TM, and sharing the DS between hibernate and a (also
slightly modified) up jboss cache.

Note that this works fine with Derby's embedded XA datasource, and they do
implement DataSource, but again, I'm a novice at all this.

Any further advice appreciated.

On 4/20/07, Heikki Linnakangas <heikki(at)enterprisedb(dot)com> wrote:
>
> Bill Middleton wrote:
> > Hello and thanks for for the efforts. I've noticed that your XA
> > implementation does not formally implement javax.sql.DataSource. I felt
> > pretty sure that this was a simple oversight, given that BaseDataSource
> > provides complete compatibility with the DataSource interface. I
> patched
> > thusly:
>
> I'm not sure that's a smart a smart thing to do. I don't think there's a
> requirement for XADataSource implementations to implement DataSource as
> well. If that was the case, surely XADataSource interface would inherit
> DataSource to enforce that. If we declare that PGXADataSource implements
> DataSource, then one can erroneously configure the container to use
> PGXADataSource in normal DataSource-mode. In fact I suspect that's the
> case in your environment as well.
>
> Can you provide a simple test case involving Hibernate so that I can try
> this out myself? What's in your hibernate config file?
>
> --
> Heikki Linnakangas
> EnterpriseDB http://www.enterprisedb.com
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Heikki Linnakangas 2007-04-20 21:16:59 Re: PGXADataSource does not implement DataSource
Previous Message Heikki Linnakangas 2007-04-20 20:32:11 Re: PGXADataSource does not implement DataSource