Roopali Gaikwad

Greenhorn
+ Follow
since Mar 05, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roopali Gaikwad

Hi,
I m using ireport for geneating my report which is having a subreport inside main report.
I m passing dataSource of type "JRBeanArrayDataSource" to main report and now i wanted to pass same datasource to subreport.
The way i tried to pass to subreport is

JRBeanArrayDataSource dataSource;
dataSource = new JRBeanArrayDataSource(mainreportData);
map.put("reportRows", dataSource);

and "reportRows" passed as parameter to subreport. But it didn't wrked.

Can anybody suggest how i can do this?

Thanks in advance.
Hi ,
I am able to relsove this prblm.Here are steps.
1. Keep your loop of iteration in service not in DO.
2. Remove the AOP property for the service from ApplicationContext.
3. Create a property of txManager bean under the bean of your service .
4. Create definition of Transaction as follows in the method where we want to set the transaction boundary.
Public void insertData()
{
DefaultTransactionDefinition df = new DefaultTransactionDefinition();
df.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus ts = txManagerBean.getTransaction(df);
boolean transcationCommitted=false;
try
{
Execute code of insert
}catch(Exception e)
{
txManagerBean.rollback(ts);
transcationCommitted=true;
}
if(!transcationCommitted)
txManagerBean.commit(ts);

}
5. This way we can achieve the transaction condition at the method level.

Hope this will help you

The servlet is getting refernce to the service from application context only.
The logic of insert is like this
public String saveData()
{
for()
{
try{
insert1();
insert2();
insert3();
}catch(Exception e)
{
// RollBack here
}
}
}

If there is exception in 2nd insert it should roll back the Insert1() also but continue the loop. This logic is present in DO so i need to set the transation boundry condition at DO level.
we are using spring jdbc framework in our project.

Right now we have kept the transcation boundry at the service level which the entry point from client side to sever side.
We have applicationContext.xml file where we have defined the transcation boundry condition for each service.

here is piece of code of applicationContext.xml
<tx:advice id="txAdvice" transaction-manager="txManager">
<!-- the transactional semantics... -->
<tx:attributes>
<!--
all methods starting with 'select' or 'get' are read-only
all methods that start with save require a new transaction
-->
<tx:method name="select*" read-only="true" />
<tx:method name="get*" read-only="true"/>
<tx:method name="save*" propagation="REQUIRES_NEW" />
<tx:method name="insert*" read-only="false" propagation="REQUIRES_NEW" />
<tx:method name="update*" propagation="REQUIRES_NEW" />
<tx:method name="import*" propagation="REQUIRES_NEW" />
<!-- other methods use the default transaction settings (see below) -->
<tx:method name="*"/>
</tx:attributes>
</tx:advice>

<!-- @1. Ensure that the above transactional advice runs for any execution
of an operation defined by the service interfaces.
@2. Defines Transaction Manager Boundaries.
-->
<aop:config>
<aop:pointcut id="usersServiceOperation" expression="execution(* com.smartLMS.server.user.services.UserService.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="usersServiceOperation" />
</aop:config>

But in one case the entry point is one sevlet from where we call the sevice method and and from service we call a method from domain object
In this case the transcation boundry is not getting applied.
and if i want to set the transaction boundry in DO level how can i do this?

Please help.