Jay Taylor's notes
back to listing indexCan I access current thread-local java.sql.Connection? - Google Groups
[web search]
Original source (groups.google.com)
Tags:
groups.google.com
Clipped on: 2013-02-01
Can I access current thread-local java.sql.Connection? 4 posts by 2 authors in Squeryl | managed by Squeryl, to avoid passing it as extra argument. Is Subj possible?
In fact, this is the use case I need quite often when working with databases of dynamic structure. For example, consider some sort of hierarchical catalog where admin can configure structure (visible properties list) of each category. This obviously requires executing ALTER TABLE along with editing category metadata, in the same transaction. So the problem is much deeper than just setting up and passing around another connection for DDL. So could you please add some static method like
You can do this already with Session.currentConnection.connection Regarding altering the schema within a transaction, some databases perform a commit of the current transaction when any DML is invoked (ok, I'm talking of oracle, ... it could be the only one doing this !;-)) So you *might* want to do this in a dedicated transaction (simply be wrapping the DML inside a transaction {} block), as opposed to using the current one. Cheers - show quoted text -
> You can do this already with > > Session.currentConnection.connection > Regarding altering the schema within a transaction, some Nooo... This time I meant exactly what I said. In the example I> databases perform a commit of the current transaction > when any DML is invoked (ok, I'm talking of oracle, ... it could be > the only > one doing this !;-)) > > So you *might* want to do this in a dedicated transaction > (simply be wrapping the DML inside a transaction {} block), > as opposed to using the current one. explained, both "update category_metadata where id=N" and "alter table category_N" form a single atomic logical operation. BTW, it's a great benefit of PostgreSQL that it correctly logs DDL > Cheers Powered by Evernote Publisher
|