Search in sources :

Example 1 with SQLQuery

use of com.mysema.query.sql.SQLQuery in project SimpleFlatMapper by arnaudroger.

the class QueryDSLTest method testMappingProjection.

@Test
public void testMappingProjection() throws Exception {
    Connection conn = DbHelper.objectDb();
    SQLQuery sqlquery = new SQLQuery(conn, new HSQLDBTemplates());
    try {
        List<DbObject> list = sqlquery.from(qTestDbObject).where(qTestDbObject.id.eq(1l)).list(new QueryDslMappingProjection<DbObject>(DbObject.class, qTestDbObject.id, qTestDbObject.name, qTestDbObject.email, qTestDbObject.creationTime, qTestDbObject.typeName, qTestDbObject.typeOrdinal));
        assertEquals(1, list.size());
        DbHelper.assertDbObjectMapping(list.get(0));
    } finally {
        conn.close();
    }
}
Also used : DbObject(org.simpleflatmapper.test.beans.DbObject) Connection(java.sql.Connection) HSQLDBTemplates(com.mysema.query.sql.HSQLDBTemplates) SQLQuery(com.mysema.query.sql.SQLQuery) Test(org.junit.Test)

Aggregations

HSQLDBTemplates (com.mysema.query.sql.HSQLDBTemplates)1 SQLQuery (com.mysema.query.sql.SQLQuery)1 Connection (java.sql.Connection)1 Test (org.junit.Test)1 DbObject (org.simpleflatmapper.test.beans.DbObject)1