Examples of SFSBHibernateSession


Examples of org.jboss.as.test.integration.jpa.hibernate.SFSBHibernateSession

    // We use extended persistence context, otherwise the Hibernate session will be closed after each transaction and
    // the assert test would fail (due to lazy loading of the Employee entity.
    // Using extended persistence context allows the hibernate session to stay open long enough for the lazy fetch.
    @Test
    public void testInjectPCIntoHibernateSession() throws Exception {
        SFSBHibernateSession sfsbHibernateSession = lookup("SFSBHibernateSession",SFSBHibernateSession.class);
        sfsbHibernateSession.createEmployee("Molly", "2 apple way", 2);

        Employee emp = sfsbHibernateSession.getEmployee(2);
        assertTrue("name read from hibernate session is Molly", "Molly".equals(emp.getName()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.