jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: question regarding jta-data-source

From: michael keith <michael.keith_at_oracle.com>
Date: Fri, 11 May 2012 16:45:05 -0400

Hi Christian,

Yes, that's pretty much how it works.

-Mike

On 11/05/2012 9:45 AM, Christian Romberg wrote:
> Hi Mike,
>
> Unlike ORMs, we need to provide the XAResource instances to the app server
> (which in turn are associated with our internal connections to the
> database server)
>
> But I guess, if the user just sees a DataSource, then that will be an
> app server proxy which eventually delegates to the XADataSource of
> our "JDBC" driver (provided I configure a DataSource that returns
> enlisted connection in the app server using our JDBC driver)
>
> So my pseudo-code assumption of the app servers DataSource proxy is
> like this:
>
> public class ContainerDataSourceProxy implements DataSource {
>
> XADataSource xaDs = ...; //XADataSource of the installed JDBC
> driver for this pool
>
> public Connection getConnection() throws SQLException {
> XAConnection xaCon = xaDs.getXAConnection();
> enlist(xaCon.getXAResource());
> return xaCon.getConnection();
> }
> ...
> }
>
> So we could simply call getConnection() (and not using the returned
> value at all) to trigger the app servers
> enlisting our XAResource.
>
> Regards,
>
> Christian
>
> On Fri, May 11, 2012 at 3:14 PM, michael keith
> <michael.keith_at_oracle.com <mailto:michael.keith_at_oracle.com>> wrote:
>
> Hi Christian,
>
> The data source referenced by the jta-data-source name is a
> DataSource provided by the container in JNDI. It is the same one
> that any application could look up and use, hence it is a
> javax.sql.DataSource.
>
> XADataSource is an internal type used by the driver and container
> to coordinate XA, but users of the data source are not expected to
> participate at that level. The JPA provider acts like a client of
> the data source, using its connections to read and write, so it
> does not need to be aware of the XA protocol being implemented
> underneath.
>
> Hope this makes things clearer.
>
> Regards,
> -Mike
>
>
> On 10/05/2012 7:50 AM, Christian Romberg wrote:
>> Hello,
>>
>> It is not explicitly mentioned in the spec, but I guess I can
>> safely assume, that the data source denoted by
>> jta-data-source is of type "javax.sql.XADataSource"?
>>
>> After the JPA implementation has obtained an XAConnection from
>> this XADataSource, is it expected to
>> to do any calls (and if so, in any specific order) on this
>> XAConnection?
>>
>> E.g. is it necessary, to call XAConnection.getConnection() to
>> trigger that the app server calls XAConnection.getXAResource()
>> on the very same XAConnection? Or is it sufficient to just call
>> "XADataSource.getXAConnection()" to trigger this?
>>
>> (Some background: we don't use JDBC connections (being not an
>> ORM) and probably we would need to provide our own
>> XADataSource implementation, so that the app server picks up our
>> own XAResource implementation)
>>
>> Thank you!
>>
>> Christian
>>
>> --
>> Christian Romberg
>> Chief Engineer| Versant GmbH
>> (T) +49 40 60990-0 <tel:%2B49%2040%2060990-0>
>> (F) +49 40 60990-113 <tel:%2B49%2040%2060990-113>
>> (E) cromberg_at_versant.com <mailto:cromberg_at_versant.com>
>> www.versant.com
>> <http://www.google.com/url?q=http%3A%2F%2Fwww.versant.com%2F&sa=D&sntz=1&usg=AFrqEzeeEBc_gN_8mxtt8xDB0tjXDXQVlw>|
>> www.db4o.com
>> <http://www.google.com/url?q=http%3A%2F%2Fwww.db4o.com%2F&sa=D&sntz=1&usg=AFrqEzdo3Q40RwKQPBtnPIuBYQd1diFxJQ>
>>
>> --
>> Versant
>> GmbH is incorporated in Germany. Company registration number: HRB
>> 54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
>> Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
>>
>> CONFIDENTIALITY
>> NOTICE: This e-mail message, including any attachments, is for
>> the sole
>> use of the intended recipient(s) and may contain confidential or
>> proprietary information. Any unauthorized review, use, disclosure or
>> distribution is prohibited. If you are not the intended recipient,
>> immediately contact the sender by reply e-mail and destroy all
>> copies of
>> the original message.
>>
>>
>>
>
>
>
> --
> Christian Romberg
> Chief Engineer| Versant GmbH
> (T) +49 40 60990-0 <tel:%2B49%2040%2060990-0>
> (F) +49 40 60990-113 <tel:%2B49%2040%2060990-113>
> (E) cromberg_at_versant.com <mailto:cromberg_at_versant.com>
> www.versant.com
> <http://www.google.com/url?q=http%3A%2F%2Fwww.versant.com%2F&sa=D&sntz=1&usg=AFrqEzeeEBc_gN_8mxtt8xDB0tjXDXQVlw>|
> www.db4o.com
> <http://www.google.com/url?q=http%3A%2F%2Fwww.db4o.com%2F&sa=D&sntz=1&usg=AFrqEzdo3Q40RwKQPBtnPIuBYQd1diFxJQ>
>
> --
> Versant
> GmbH is incorporated in Germany. Company registration number: HRB
> 54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
> Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
>
> CONFIDENTIALITY
> NOTICE: This e-mail message, including any attachments, is for the sole
> use of the intended recipient(s) and may contain confidential or
> proprietary information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient,
> immediately contact the sender by reply e-mail and destroy all copies of
> the original message.
>
>
>