vaijesh basavarajappa

Greenhorn
+ Follow
since Feb 04, 2013
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 vaijesh basavarajappa

Thanks Bill for the reply.It got solved.but really i dont know the reason.

I have java project and web project bundled as Ear.In java project context i have defined <tx:annotation-driven /> and in web project i have defined <context:annotation-config />.
Actually Transaction was not active because i have defined <context:annotation-config /> and <tx:annotation-driven /> in different root context .
After moving both in single context it got worked.The transaction have become active.

Could you please explain me why transaction was not active when defined in different context.

Thanks
Vaijesh
7 years ago
In My service layer i am using @transaction.From service i am calling DAO

Service layer code:



DAO COde:


Business Object:


Spring Configuration:

<tx:annotation-driven />
<tx:jta-transaction-manager />
<bean id="entitymanager"
class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.OpenJpaV endorAdapter" >
<property name="database" value="DB2" />
<property name="showSql" value="true" />
<property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.DB2Dictionary" />
</bean>
</property>
</bean>
<bean class="org.springframework.orm.jpa.support.Persist enceAnnotationBeanPostProcessor" />



Persistence xml:

<persistence-unit name="X" transaction-type="JTA">
<jta-data-source>jdbc/datasource</jta-data-source>
<class>com.businessobjects.Location</class>
</persistence-unit>

When i run on Websphere application server,my location object is not saved.I am not getting any error.No sql statement are showed on console

If i put @Transaction on DAO addLocation method.it is getting saved(insert statement are showed).But i need to put on service layer so that i can call other DAo methods in the same transaction.

Console stackTrace is:

INFO [WebContainer : 2] openjpa.Runtime - Starting OpenJPA 2.1.1-SNAPSHOT
[2/14/13 22:53:50:868 IST] 00000032
SystemErr R 19494 TRACE [WebContainer : 2] openjpa.jdbc.SQL - <t 31882503, conn 29839727> executing stmnt 29839913 SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1
[2/14/13 22:53:50:868 IST] 00000032
SystemErr R 19494 TRACE [WebContainer : 2] openjpa.jdbc.SQL - <t 31882503, conn 29839727> [0 ms] spent


Please help me.

Thanks
vaijesh
7 years ago
I guess you missed out driverClassName property while configuring datasource.

Vaijesh
7 years ago
Hi,
what isolation level should be used for basic CRUD operation in Spring JTA Transaction.

I have one java project and 2 Web Applications which are bundled in EAR.
In java project i have service classes and DAO classes which are shared between web application using Spring configured using context param parentContextKey .
And web application specific DAO 's are in web application project.
DAO 's does basic CRUD operations.
I my using @persistenceContext which injected is injected in DAO using Spring.

so my question is which isolation level should i use when i annotated the method with @Transaction.By default ISOLATION_SERIALIZABLE is used.
what is isolation_default level will do.

Please help to understand when to use ISOLATION_SERIALIZABLE and ISOLATION_DEFAULT.Considering the above scenario please help me to choose isolation level if any thing else i need to use.
And also we are going to create Clusters for the EAR in Websphere Application Server.Does isolation level have any impact on the Clusters.
Please help me.
Thanks in Advance.
7 years ago
Hi All,

Please help to generate html tabs in email template using springs.i want to include tabs in email.For Example: TAB1 TAB2. on click of TAB1 i want show some text "abcd".On click of TAB2 i want to show some tex t "efgh".

I used following code:


public class CustomerController{

@Autowired(required=true)
private JavaMailSender mailSender;

@Autowired(required=true)
private VelocityEngine velocityEngine;

@RequestMapping("/customer/add.htm")
public ModelAndView add(HttpServletRequest request,
HttpServletResponse response) throws Exception {
MimeMessage message=mailSender.createMimeMessage();
MimeMessageHelper helper=new MimeMessageHelper(message,true);
helper.setFrom("xxxx@gmail.com");
helper.setTo("xxxx@gmail.com");
helper.setSubject("Sending sample template");

Map<String, Object> model=new HashMap<String, Object>();
model.put("testing", "Ganesha is Lord");
String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "test3.vm", model);
FileSystemResource res = new FileSystemResource(new File("c:/header.jpg"));


helper.setText(text,true);
helper.addInline("identifier1234", res);

mailSender.send(message);
System.out.println("Ganesha sending mail"+text);

return new ModelAndView("CustomerPage", "msg","add() method");

}

}

Test3.vm file contains:

<html>
<head>
<script type="text/javascript">

function activateTab(pageId) {
var tabCtrl = document.getElementById('tabCtrl');
var pageToActivate = document.getElementById(pageId);
for (var i = 0; i < tabCtrl.childNodes.length; i++) {
var node = tabCtrl.childNodes[i];
if (node.nodeType == 1) { /* Element */
node.style.display = (node == pageToActivate) ? 'block' : 'none';
}
}
}

</script>
</head>
<body>
<img src='cid:identifier1234'>
<ul>
<li>
<a href="javascript:activateTab('page1')">${testing}</a>
</li>
<li>
<a href="javascript:activateTab('page2')">Tab 2</a>
</li>
...
</ul>
<div id="tabCtrl">
<div id="page1" style="display: block;">Page 1</div>
<div id="page2" style="display: none;">Page 2</div>
...
</div>
</body>
</html>

I could able to display the image.but tabs are not working.
Please help me.

Thanks in advance.

7 years ago