के लिए काम करने के लिए @ रोलबैक नहीं मिल सकता है यह मेरे पास एक छोटी परीक्षा कक्षा है। समस्या यह है कि यह प्रत्येक टेस्ट रन के बाद लेनदेन को वापस नहीं ले रहा है। मैंने क्या गल्त किया है? :)मेरे स्प्रिंग जेपीए इंटीग्रेशन टेस्ट
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/META-INF/catalog-spring.xml" })
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
public class TermTest
{
@Autowired
private CatalogService service;
@Rollback(true)
@Test
public void testSimplePersist()
{
Term term = new Term();
term.setDescription("Description");
term.setName("BirdSubject8");
term.setIsEnabled("F");
term.setIsSystem("F");
term.setTermType("TERM");
service.createTerm(term);
}
}
और मेरे वसंत config
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="catalog2"></property>
</bean>
<bean id="catalogService" class="com.moo.catalog.service.CatalogService">
<property name="termDao" ref="termDao"></property>
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven />
मैं एल ओवे आप! (आपने बहुत जल्दी उत्तर दिया है, लेकिन मुझे एक और 4 मिनट की आवश्यकता है क्योंकि मैं एक जवाब स्वीकार कर सकता हूं) – willcodejavaforfood
वास्तव में मैंने जो जवाब दिया होगा, अगर मैंने समय में दिखाया था (+1) –
@seanizer - मैं कम से कम आपकी टिप्पणी को ऊपर उठाऊंगा :) – willcodejavaforfood