[EJB 3.0] - how to rollback a DB manipulation SQL in a method
by mrchit_2000
Hi all,
I have this question regarding rolling back and I thought it is handled by Transaction Manager of the EJB 3.0 but it doesnot seem so.
The problem is I have method in a Stateless session bean that trying to remove some rows in 1 table first and and then insert some rows in the other table. I want to make sure if the insertion failed in the second step, all of those removals would be rolled back. I use the EntityManager to do the delete and insert. Here are the pseudocode of my method
void updateDB (){
|
| removeRows();
| addRows();
| }
| void removeRows(){
| //use EntityManager to remove
| }
|
| void addRows(){
| //use EntityManager to insert some rows
| }
|
Could anyone tell me how to make sure if the call to addRows failed, such as insert a duplicate row, would cause the removeRows rolledback?
Thank you very much in advance,
LNgo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031365#4031365
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031365
19Â years, 1Â month
[JBoss/Spring Integration] - Re: Problem persisting data using Spring + Hibernate JPA
by suneetshah
The xml file did not paste properly:
<bean id="serviceManager" class="diamelle.common.service.ServiceMgr"
| <constructor-arg ref="serviceDAO"></constructor-arg>
| </bean>
|
| <bean id="serviceDAO" class="diamelle.common.service.ServiceDAOBean" >
| <property name="entityManagerFactory" ref="entityManagerFactory" />
| </bean>
|
|
| <bean id="entityManagerFactory"
| class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
| <property name="dataSource" ref="dataSource" />
| <property name="jpaVendorAdapter">
| <bean
| class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
| <property name="generateDdl" value="false" />
| <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect" />
| <property name="showSql" value="true" />
| </bean>
| </property>
| </bean>
|
| <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
| <property name="driverClassName" value="com.mysql.jdbc.Driver" />
| <property name="url" value="jdbc:mysql://localhost:3306/mysql" />
| <property name="username" value="idmuser" />
| <property name="password" value="idmuser" />
| </bean>
|
| <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
| <property name="dataSource" ref="dataSource" />
| <property name="entityManagerFactory" ref="entityManagerFactory" />
| </bean>
|
| <tx:annotation-driven transaction-manager="transactionManager" />
| <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
| <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
|
|
|
| </beans>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031363#4031363
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031363
19Â years, 1Â month
[JBoss Seam] - f:setPropertyActionListener and s:link
by elikyip
Does anyone know if f:setPropertyActionListener and s:link work together? I have the following code snippets and it does not seem like my backing bean "selectedTab" property is being set.
Any help is appreciated.
<s:link action="#{topNavBar.select}" value="Performance" propagation="none">
<f:setPropertyActionListener target="#{topNavBar.selectedTab}" value="performance"/>
</s:link>
@Name("topNavBar")
@Scope(ScopeType.EVENT)
public class TopNavBar {
@Logger
private Log logger;
@RequestParameter
private String greeting = "No Greeting";
private String selectedTab;
public String getSelectedTab() {
return selectedTab;
}
public void setSelectedTab(String selectedTab) {
this.selectedTab = selectedTab;
}
public String getGreeting() {
return greeting;
}
public String select() {
return "redirect-index";
}
public void setGreeting(String greeting) {
this.greeting = greeting;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031360#4031360
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031360
19Â years, 1Â month
[JBoss Seam] - Re: Vanishing component....
by tony.herstellï¼ gmail.com
| 11:29:10,281 ERROR [SeamPhaseListener] uncaught exception
| javax.faces.el.EvaluationException: Cannot get value for expression '#{uploadController}'
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
| at org.jboss.seam.actionparam.ActionParamBindingHelper.findParamTypes(ActionParamBindingHelper.java:94)
| at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:55)
| at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
| at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:106)
| at org.jboss.seam.core.Pages.callAction(Pages.java:466)
| at org.jboss.seam.core.Pages.enterPage(Pages.java:275)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031354#4031354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031354
19Â years, 1Â month