I am using Struts as frontEnd and Spring for IOC and hibernate + c3p0 as datasource pooling. I am using annotationsessionfactory bean and @Transaction annotation for my persistent layer. all this is managed using spring beans.
but my data is saved also if i am not using @transactional annotation on the persistence layer methods.
example:
public interface CollegeHibernate {
CollegeWTO saveCollege(CollegeWTO collegeWTO);
}
public class CollegeHibernateImpl extends HibernateTemplate implements CollegeHibernate{
public CollegeWTO saveCollege(CollegeWTO collegeWTO) {
College college = CollegeHelper.CollegeWTO_to_Model(new College(), collegeWTO);
}
}
bean is
<bean id="collegeHibernate" class="com.velos.p1b.persistence.college.impl.CollegeHibernateImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
session factory is spring annotation factory and transaction is managed like this.
<tx:annotation-driven transaction-manager="transactionManager" />
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" read-only="true" rollback-for="java.lang.Throwable" />
</tx:attributes>
</tx:advice>
This method saves data but i don't make it transactional at all. According to me it have to through exception. I am using oracle 11g and j-boss 4.2 server. What I am thinking is that my transaction is not managed. Any example is appreciated.