Search in sources :

Example 96 with SessionImplementor

use of org.hibernate.engine.spi.SessionImplementor in project jbosstools-hibernate by jbosstools.

the class ClassMetadataFacadeTest method testGetIdentifier.

@Test
public void testGetIdentifier() {
    assertNull(((TestEntityPersister) classMetadataTarget).session);
    final SessionImplementor sessionTarget = createSession();
    ISession sessionFacade = FACADE_FACTORY.createSession(sessionTarget);
    @SuppressWarnings("serial") Serializable theObject = new Serializable() {
    };
    Object anotherObject = classMetadataFacade.getIdentifier(theObject, sessionFacade);
    assertSame(theObject, anotherObject);
    assertSame(sessionTarget, ((TestEntityPersister) classMetadataTarget).session);
}
Also used : Serializable(java.io.Serializable) ISession(org.jboss.tools.hibernate.runtime.spi.ISession) SessionImplementor(org.hibernate.engine.spi.SessionImplementor) Test(org.junit.jupiter.api.Test)

Example 97 with SessionImplementor

use of org.hibernate.engine.spi.SessionImplementor in project jbosstools-hibernate by jbosstools.

the class ClassMetadataFacadeTest method testGetIdentifier.

@Test
public void testGetIdentifier() {
    assertNull(((TestEntityPersister) classMetadataTarget).session);
    final SessionImplementor sessionTarget = createSession();
    ISession sessionFacade = FACADE_FACTORY.createSession(sessionTarget);
    @SuppressWarnings("serial") Serializable theObject = new Serializable() {
    };
    Object anotherObject = classMetadataFacade.getIdentifier(theObject, sessionFacade);
    assertSame(theObject, anotherObject);
    assertSame(sessionTarget, ((TestEntityPersister) classMetadataTarget).session);
}
Also used : Serializable(java.io.Serializable) ISession(org.jboss.tools.hibernate.runtime.spi.ISession) SessionImplementor(org.hibernate.engine.spi.SessionImplementor) Test(org.junit.jupiter.api.Test)

Aggregations

SessionImplementor (org.hibernate.engine.spi.SessionImplementor)97 Test (org.junit.Test)60 Session (org.hibernate.Session)58 Connection (java.sql.Connection)20 TestForIssue (org.hibernate.testing.TestForIssue)18 PreparedStatement (java.sql.PreparedStatement)17 EntityPersister (org.hibernate.persister.entity.EntityPersister)14 Work (org.hibernate.jdbc.Work)13 Statement (java.sql.Statement)12 List (java.util.List)12 Transaction (org.hibernate.Transaction)12 ResultSet (java.sql.ResultSet)11 SQLException (java.sql.SQLException)11 Serializable (java.io.Serializable)8 ArrayList (java.util.ArrayList)7 EntityEntry (org.hibernate.engine.spi.EntityEntry)7 JDBCException (org.hibernate.JDBCException)6 CollectionEntry (org.hibernate.engine.spi.CollectionEntry)6 QueryParameters (org.hibernate.engine.spi.QueryParameters)6 ResultSetProcessor (org.hibernate.loader.plan.exec.process.spi.ResultSetProcessor)6