Hi,
you should have one ULTM (TxManager + managed DataSource) per
application (assuming you have only one database).

What seems strange to me is why do you use
"DSL.using(getConfiguration())" everywhere instead of creating
DSLContext once and use that everywhere? There is no need to create it
all the time, one instance should be enough.

Do you use DI? It's brilliant design pattern. The basic idea is to
split object creation code from business logic, so I create TxManager
and DSLContext once and inject it everywhere I need (using Guice or if
you do not want it, by manually creating and configuring objects when
bootstrapping application). It works flawlessly.

There is no need to pass TxManager everywhere. I would use it on some
external layer, like some gateway, to begin and commit or rollback,
but your case can be a little bit different, so I cannot tell.
Referring to your example with CarManager and WheelManager, it would
look odd to operate with TxManager in one and not use it in another
(but you can do this). However, I would think about getting rid of
transaction management from those manager, because if you start
transaction yet elsewhere, in some ThirdManager, then you cannot call
CarManager (because it handles transactions by itself) but you can
call WheelManager (because it doesn't).

In my app, there is only one "point of entry", but there might be many
(like JAX-RS endpoints).

There is no mailing list for ULTM, but fell free to ask question on
issue tracker, because I am not sure if people here are interested :)

Regards,
Witold Szczerba

On Mon, Dec 8, 2014 at 4:52 PM, Garret Wilson <[email protected]> wrote:
> Witold, thanks for the update. I haven't yet talked to our main database
> developer, but on first glance it looks like ULTM would be great for us!!
> Let me clarify a few things.
>
> Our code has an application that creates a jOOQ Configuration from a data
> source:
>
>       final org.jooq.Configuration jooqConfiguration = new
> DefaultConfiguration()
>           .set(datasource).set(SQLDialect.POSTGRES).set(new
> Settings().withExecuteLogging(true));
>
> We store this jOOQ Configuration in e.g. some DI container. In all the
> manager layer, we access jOOQ like this:
>
>     return DSL.using(getConfiguration());
>
> We therefore have one jOOQ Configuration (created from a single data source)
> for the entire application, and when we need to do database access we create
> a DSLContext on the fly from the configuration. I frankly don't know the
> details of how jOOQ then creates JDBC connections under the hood; this is
> not my area of expertise.
>
> So with ULTM, would we create one TxManager (also from the data source) at
> the same level as the jOOQ Configuration, and make it available via the DI
> container? If we create multiple jOOQ DSLContexts on the fly from the jOOQ
> Configuration, how does that interact with ULTM?
>
> Let's further suppose that I have a CarManager and a WheelManager. Storing a
> Car using CarManager.storeCar() would I assume use TxManager to wrap the
> logic in a transaction. But inside that logic it calls
> WheelManager.storeWheel() four times. Does WheelManager simply do its work
> without worrying about transactions? Do I need to pass the TxManager to
> WheelManager? Will the DSLContext create a new connection that isn't part of
> the same transaction? Do I need to pass the DSLContext to WheelManager? Do I
> need to pass the JDBC connection to WheelManager? Or is TXManager somehow
> managing all this under the hood?
>
> I'm sure if I had more SQL expertise the answers to some of these questions
> might be obvious. Thanks in advance for your help.
>
> Garret
>
> On 12/7/2014 1:10 AM, Witold Szczerba wrote:
>>
>> The ULTM v.1.0 is released and published (Maven Central and jCenter at
>> Bintray).
>> Project page is here:
>> https://github.com/witoldsz/ultm
>>
>> Thank you,
>> Witold Szczerba
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to