[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Using JBoss's JDBC Managed Connection Pools

wls do-not-reply at jboss.com
Wed Feb 14 15:52:29 EST 2007


Ok, so here's what I'm learning so far -- and perhaps my question was nonsensical.

In JDBC you get a connection, to which you can have database transactions.

When you start talking about Transactions in terms of JBoss, these are NOT database transactions, but unit of work transactions.

If your bean happens to represent some piece of business logic, then it's easy to see how invoking a method on that bean starts a transaction, and when the method exits, the transaction is done.  Complexity arises when beans start using other beans, because you have to decide if it's part of the same transaction, a separate transaction, and if the transactions have any dependency on one another.

JBoss can persist your bean using Container Managed Persistence (CMP), or your bean can persist itself using Bean Managed Persistence (BMP).  In each case, it uses a database connection pool ...and so far things make sense.

My problem is that my bean is stateless with no data to persist.  It merely enters a very long look when told to do so.  My thought was that I, as a bean writer, had the exact same access to the database connection pool and could use it to serve my whims, wholly independent of object persistence.

Two things are complicating that.  One, I can't seem to get the JBoss connection pool to let me have a connection which allows me to do commits.  Two, all of my processing seems to be happening in the context of some magic all-encompassing wrapper transaction, so even when I do twiddle with the database, using the connection pool, it won't commit until the invoking method exits.  And for what I want to do, that isn't helpful at all.

Is there a way, perhaps with some annotation or something, to indicate that no transaction is desired?  And is there a way to grab a raw connection from the connection pool?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016619#4016619

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016619



More information about the jboss-user mailing list