Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 122E99FB271 for ; Fri, 20 Apr 2007 17:56:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 83192-02 for ; Fri, 20 Apr 2007 17:56:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.235]) by postgresql.org (Postfix) with ESMTP id 718769FB216 for ; Fri, 20 Apr 2007 17:56:43 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 70so1078267wra for ; Fri, 20 Apr 2007 13:56:42 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=hHlSNNHNuiQKAdqeAw//B4Hfje1fxoG10AqJOvq1nMYmiH/8blQzjyvKFQZCPhjUad70oFlqGvCjPC3Sx8Scka9YXdaFPXabx1TJJD/bd5Tl+wepVPk/wP0WRlst5KoM+ZRyrb58pq4fazon8xyz7aNa0cx2zD20DGDKIPR/LJM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=A6Z7EbRgXPTARoaRnlPZQwd6JmXQSzCLjtpEp5L55YgYEVBm6WqqZf+0esYhbSniL6I4oLazj0GrFqRj50SAJ9sK75x3FRvsqS94uvcd7UEkWeeqlEUJL+TdR0xqBQRB13YESeo3h+pzrsq3CvjjJQYZrg7v/3Gew+kfvL1a2o0= Received: by 10.114.180.1 with SMTP id c1mr1383411waf.1177102602121; Fri, 20 Apr 2007 13:56:42 -0700 (PDT) Received: by 10.114.88.2 with HTTP; Fri, 20 Apr 2007 13:56:41 -0700 (PDT) Message-ID: <4efe54510704201356i7f5c1d51i9b73b2e186c81b31@mail.gmail.com> Date: Fri, 20 Apr 2007 22:56:41 +0200 From: "Bill Middleton" To: "Heikki Linnakangas" , books@ejurka.com Subject: Re: PGXADataSource does not implement DataSource Cc: pgsql-jdbc@postgresql.org In-Reply-To: <4629234B.8050507@enterprisedb.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_129869_22851094.1177102601938" References: <4efe54510704201300i4636c611r88dbb48c96be7270@mail.gmail.com> <4629234B.8050507@enterprisedb.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/82 X-Sequence-Number: 16931 ------=_Part_129869_22851094.1177102601938 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: org.hibernate.dialect.PostgreSQLDialect java:comp:myDS org.hibernate.transaction.JTATransactionFactory 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 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 > ------=_Part_129869_22851094.1177102601938 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.xml are 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@enterprisedb.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

------=_Part_129869_22851094.1177102601938--