[JCA/JBoss] - Re: shouldn't local-tx-datasource have auto-commit = false?
by weston.price@jboss.com
Whoops, sorry, I just saw it ;-)
Ok, there are two real choices you have here:
1) Leverage typical JDBC transactions with Hibernate.
By default, Hibernate, if not told otherwise, will use JDBC tranasactions. Being that no CMT is being started in this case, the underlying connection will have it's autoCommit value set to true (as per the JCA specification), regardless of the type of datasource being used. Note, Hibernate may turn this off/on but JBossJCA will not.
2) Use CMT or UserTransactions to begin a transaction and have Hibernate participate in this scheme by correctly configuring Hibernate to use a different TransactionStrategy/Lookup.
Once you do this, JBossJCA will correctly set the autocommit flag on the underlying connection to participate in the global transaction.
Again, I need some more information as to what context are you using Hibernate. Are you doing this from a Servlet, from an EJB etc?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004554#4004554
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004554
19 years, 3 months
[JBoss Seam] - Re: one question about Interceptor
by diyun2008
You probably misunderstand.
The comlete code is here:
import javax.faces.event.PhaseId;
|
| import org.jboss.seam.annotations.Interceptor;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.contexts.Lifecycle;
| import org.jboss.seam.interceptors.BijectionInterceptor;
| import org.jboss.seam.interceptors.BusinessProcessInterceptor;
| import org.jboss.seam.interceptors.ConversationInterceptor;
| import org.jboss.seam.interceptors.RemoveInterceptor;
| import org.jboss.seam.interceptors.ValidationInterceptor;
|
| @Interceptor(around={BijectionInterceptor.class, ValidationInterceptor.class,
| ConversationInterceptor.class, BusinessProcessInterceptor.class},
| within=RemoveInterceptor.class)
| public class LoggedInInterceptor
| {
|
| @AroundInvoke
| public Object checkLoggedIn(InvocationContext invocation) throws Exception
| {
| boolean isLoggedIn = Contexts.getSessionContext().get("loggedIn")!=null;
| if ( Lifecycle.getPhaseId()==PhaseId.INVOKE_APPLICATION )
| {
| if (isLoggedIn)
| {
| return invocation.proceed();
| }
| else
| {
| return "login";
| }
| }
| else
| {
| if ( isLoggedIn )
| {
| return invocation.proceed();
| }
| else
| {
| Method method = invocation.getMethod();
| if ( method.getReturnType().equals(void.class) )
| {
| return null;
| }
| else
| {
| return method.invoke( invocation.getTarget(), invocation.getParameters() );
| }
| }
| }
| }
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004553#4004553
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004553
19 years, 3 months