Pessoal
eu fiz o seguinte teste
enviei um objeto com uma coleção dentro dele para ser salvo no banco, até ai tudo bem,
o hibernate entro em ação, e salvo o objeto primeiro, e depois foi salvar a coleção dentro dele,
ocorreu um erro no banco quando foi ser salvo a coleção, o Spring não deveria fazer o rollback no objeto ? Por que ele não fez, ele inseriu no banco o objeto.
esse é uma parte do arquivo de configuração do spring
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSourceExemplo"/>
</property>
<property name="annotatedClasses">
<list>
<value>br.gov.in.assinatura.pojo.Pessoa</value>
<value>br.gov.in.assinatura.pojo.CachorroPessoa</value>
<value>br.gov.in.assinatura.pojo.RacaoCachorro</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="connection.autocommit">true</prop>
</props>
</property>
</bean>
<bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_REQUIRED </prop>
<prop key="delete*">PROPAGATION_REQUIRED </prop>
<prop key="update*">PROPAGATION_REQUIRED </prop>
<prop key="save*">PROPAGATION_REQUIRED </prop>
<prop key="get*">ROPAGATION_SUPPORTS,readOnly</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
Pelo que eu andei lendo, ele faz rollback a parti da exeção que é lançada, aonde eu configuro o rollback aqui?
vlw