Code example for AnnotationConfiguration

Methods: configure, buildSessionFactory

0
	/** 
	 * Getting a real Hibernate Session, from a memory database. 
	 */ 
	@Before 
	public void setUp() throws Exception {
		AnnotationConfiguration cfg = new AnnotationConfiguration();
		cfg.configure().setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:mydvdsDB");
		session = cfg.buildSessionFactory().openSession();
		session.beginTransaction(); 
		dao = new DefaultDvdDao(session);
	} 
 
 
	/** 
	 * Undoing all changes to database 
	 * @throws Exception 
	 */ 
	@After 
	public void tearDown() throws Exception {
		if (session != null && session.getTransaction().isActive()) {