Code example for Session

Methods: closeget

0
		Session session = openSession();
 
		try { 
			if ( loadAbstractProxyBeforeSearch ) {
				// Load a proxified version of the entity into the session 
				LazyAbstractEntityReference reference = (LazyAbstractEntityReference) session.get(
						LazyAbstractEntityReference.class, entityReferenceId );
				assertTrue( reference != null && !Hibernate.isInitialized( reference.getEntity() ) );
			} 
 
			// Search for the created entity 
			assertEquals( 1, doSearch( session, clazz, entityId ).size() );
		} 
		finally { 
			session.close();
		} 
	} 
 
	private void populateDatabase() { 
		Session session = openSession();