-
1. Re: JDBC Transaction integration
hstang Jan 2, 2007 10:19 AM (in response to flozanolopez)JPA supports native named queries using @NamedNativeQuery annotation. You can use JDBC with this approach.
-
2. Re: JDBC Transaction integration
flozanolopez Jan 2, 2007 10:47 AM (in response to flozanolopez)"hstang" wrote:
JPA supports native named queries using @NamedNativeQuery annotation. You can use JDBC with this approach.
It's an interesting approach, but what about the JMS transactions? -
3. Re: JDBC Transaction integration
hstang Jan 2, 2007 11:08 AM (in response to flozanolopez)Good question.
I am unsure if Seam provides a transactional session, but I wouldn't think it's too hard to do.
Perhaps someone else more knowledgeable on this topic(no pun intended) can comment on this -
4. Re: JDBC Transaction integration
norman.richards Jan 2, 2007 2:10 PM (in response to flozanolopez)Yes, you'll find that JPA let's you do pretty much what you want. If not, you can hit the datasource. You can't inject a datasource directly. You'd need to create an @Unwrap component to perform the actual datasource JNDI lookup. Then you can directly inject it. Or, you can use an EJB3 component and use the @Resource annotation to get the data source. But, I'd recommend trying to use the JPA functionality.
Datasources are transactional and are aware of your JTA transaction. You don't have to do ANYTHING to get this to work. I would recommend using the TransactionalSeamPhaseListener and letting Seam manage the transactions to let Seam control the transaction boundaries.
If all of your stuff is going to the same DB, I don't think you truly need XA. But, if you do, have a look at the new jboss transaction manager. http://labs.jboss.com/portal/jbosstm. (the old arjuna stuff) -
5. Re: JDBC Transaction integration
flozanolopez Jan 2, 2007 5:19 PM (in response to flozanolopez)"norman.richards@jboss.com" wrote:
Yes, you'll find that JPA let's you do pretty much what you want. If not, you can hit the datasource. You can't inject a datasource directly. You'd need to create an @Unwrap component to perform the actual datasource JNDI lookup. Then you can directly inject it. Or, you can use an EJB3 component and use the @Resource annotation to get the data source. But, I'd recommend trying to use the JPA functionality.
Datasources are transactional and are aware of your JTA transaction. You don't have to do ANYTHING to get this to work. I would recommend using the TransactionalSeamPhaseListener and letting Seam manage the transactions to let Seam control the transaction boundaries.
If all of your stuff is going to the same DB, I don't think you truly need XA. But, if you do, have a look at the new jboss transaction manager. http://labs.jboss.com/portal/jbosstm. (the old arjuna stuff)
Thankyou very much for such a deep answer, it's very helpful. I'll check all these topics shortly :)
Our transactions are all against the same database (if using the same datasource in JPA and in pure JDBC, I don't think we'll have any problem, right?). The only problem is JMS, but I guess it's also covered by what you said and by marking a given method @Transactional, all the JMS operations performed within the boundaries of that method become part of the same transaction. -
6. Re: JDBC Transaction integration
norman.richards Jan 2, 2007 6:32 PM (in response to flozanolopez)If everything is using the same datasource, you shouldn't have any special TX concerns. With a Seam-managed tx, seam will start the tx at the right time so that everything comes together right and you won't have to worry about @Transactional or anything like that, at least not in the general case.