Code example for SessionFactory

Methods: openSession

0
		this.factory = factory;
	} 
	 
	@PostConstruct 
	public void create() { 
	    session = this.factory.openSession();
	} 
 
	@Produces 
	@RequestScoped 
	public Session getInstance() {
		return session; 
	} 
	 
	public void destroy(@Disposes Session session) {
	    session.close();
	} 
	 
	 
 
Connect your IDE to all the code out there  Get Codota for Java