Sequence Number in testing Spring application with JUnit (Hibernating, Spring MVC)

Posted by MBK on Stack Overflow See other posts from Stack Overflow or by MBK
Published on 2013-10-17T15:46:41Z Indexed on 2013/10/17 15:54 UTC
Read the original article Hit count: 131

Filed under:
|
|

I am testing DAO in Spring Application.

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/applicationContext.xml")
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@Transactional
public class CommentDAOImplTest { @Autowired //testing mehods here}

The tests are running good. Iam able to add an comment and I also have a defaultRollback property set. So, the added comment will be deleted automatically. happy!..Now the problem is with the sequence number for mcomment. Can I, in any way rollback the seq number? any suggestins on that. I dont want to mess up the sequrnce number. Business requires comment Id to be showed. (I still dont know why).

I know in memory db is an option....but I am guessing defaultRollback purpose is to eliminate in memory db testing and mocking. (Just my opinion.)

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about spring-mvc