I try to rollback so that I write small program to check it.
But it doesn't work. The data is stored in DB. Seam is 1.0.0.CR3, JBOSS is
4.0.4.GA and MySQL 4.0.16.
I find the word rollback in server.log but it doesn't roll back.
Any message and advice is helpful.
put the lines below in faces-config.xml
| <lifcycle>
|
<phase-listner>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListner
| </phase-linstner>
| </lifecycle>
|
and
| <filter>
| <filter-name>Seam Exception Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Exception Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
|
in web.xml
code is
| package transaction.action;
|
| import javax.annotation.Resource;
| import javax.ejb.SessionContext;
| import javax.ejb.Stateless;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.TransactionAttributeType;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import org.jboss.seam.annotations.Name;
|
| import transaction.entity.Customer;
|
| @Stateless
| @Name("saveDataAction")
| public class SaveDataAction implements SaveData {
|
| @PersistenceContext
| EntityManager em;
|
| @Resource
| SessionContext ctx;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void storeData() {
| Customer customer = new Customer();
| int value = (int)(100 * Math.random());
| customer.setFirstName("SUSUMU" + String.valueOf(value));
| customer.setLastName("MAJIMA" + String.valueOf(value));
|
| em.persist(customer);
|
| ctx.setRollbackOnly();
|
| }
|
| }
|
server.log is
2006-06-29 09:10:41,422 DEBUG [org.hibernate.impl.SessionImpl] opened session
at timestamp: 4716707189825536
2006-06-29 09:10:41,422 DEBUG [org.hibernate.jdbc.JDBCContext]
TransactionFactory reported no active transaction; Synchronization not
registered
2006-06-29 09:10:41,422 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl]
Looking for a JTA transaction to join
2006-06-29 09:10:41,437 DEBUG [org.hibernate.jdbc.JDBCContext] successfully
registered Synchronization
2006-06-29 09:10:41,437 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl]
Looking for a JTA transaction to join
2006-06-29 09:10:41,437 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl]
Transaction already joined
2006-06-29 09:10:41,796 DEBUG
[org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert
immediately
2006-06-29 09:10:41,796 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to
open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-06-29 09:10:41,796 DEBUG [org.hibernate.jdbc.ConnectionManager] opening
JDBC connection
2006-06-29 09:10:41,796 DEBUG [org.hibernate.SQL] insert into CUSTOMER
(FIRSTNAME, LASTNAME) values (?, ?)
2006-06-29 09:10:41,827 DEBUG [org.hibernate.id.IdentifierGeneratorFactory]
Natively generated identity: 27
2006-06-29 09:10:41,827 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to
close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-06-29 09:10:41,827 DEBUG [org.hibernate.jdbc.ConnectionManager]
aggressively releasing JDBC connection
2006-06-29 09:10:41,827 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing
JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets:
0, globally: 0)]
2006-06-29 09:10:41,858 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,858 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,858 DEBUG
[org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] rolling back
transaction after phase: INVOKE_APPLICATION(5)
2006-06-29 09:10:41,858 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,874 DEBUG [org.hibernate.jdbc.JDBCContext]
TransactionFactory reported no active transaction; Synchronization not
registered
2006-06-29 09:10:41,874 DEBUG [org.hibernate.jdbc.JDBCContext]
TransactionFactory reported no active transaction; Synchronization not
registered
2006-06-29 09:10:41,874 DEBUG [org.hibernate.jdbc.JDBCContext]
TransactionFactory reported no active transaction; Synchronization not
registered
2006-06-29 09:10:41,874 DEBUG
[org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing
entity managersession **************
2006-06-29 09:10:41,874 DEBUG [org.hibernate.jdbc.JDBCContext]
TransactionFactory reported no active transaction; Synchronization not
registered
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,874 DEBUG
[org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] beginning
transaction prior to phase: RENDER_RESPONSE(6)
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.Component] instantiating Seam
component: facesMessages
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.core.Manager] Discarding
conversation state: 2
2006-06-29 09:10:41,874 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page
context
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,889 DEBUG
[org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] committing
transaction after phase: RENDER_RESPONSE(6)
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Lifecycle] After render
response, destroying contexts
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying
event context
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Contexts] destroying:
org.jboss.seam.core.manager
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying
conversation context
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Contexts] destroying:
facesMessages
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing
server-side conversation context
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web
request
2006-06-29 09:10:41,889 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
Thanks in advance
Susumu
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954216#3954216
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954216
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user