Last active
December 15, 2015 21:58
-
-
Save superalsrk/5329202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void setUp() throws Exception { | |
ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:/spring/applicationContext.xml"); | |
ordersDAO = (OrdersDAO) ctx.getBean("ordersDAO"); | |
userDAO = (UserDAO) ctx.getBean("userDAO"); | |
houseDAO = (HouseDAO) ctx.getBean("houseDAO"); | |
sessionFactory = (SessionFactory) ctx.getBean("sessionFactory"); | |
session = SessionFactoryUtils.getSession(sessionFactory, true); | |
session.setFlushMode(FlushMode.MANUAL); | |
TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session)); | |
} | |
@After | |
public void tearDown() throws Exception { | |
TransactionSynchronizationManager.unbindResource(sessionFactory); | |
SessionFactoryUtils.releaseSession(session, sessionFactory); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment