Search in sources :

Example 1 with MySQLTemplates

use of com.querydsl.sql.MySQLTemplates in project querydsl by querydsl.

the class NativeSQLSerializerTest method path_column2.

@Test
public void path_column2() {
    PathBuilder<Entity> entity = new PathBuilder<Entity>(Entity.class, "entity");
    Configuration conf = new Configuration(new MySQLTemplates());
    NativeSQLSerializer serializer = new NativeSQLSerializer(conf, true);
    serializer.handle(entity.get("firstName"));
    assertEquals("entity.first_name", serializer.toString());
}
Also used : MySQLTemplates(com.querydsl.sql.MySQLTemplates) PathBuilder(com.querydsl.core.types.dsl.PathBuilder) Configuration(com.querydsl.sql.Configuration) Test(org.junit.Test)

Example 2 with MySQLTemplates

use of com.querydsl.sql.MySQLTemplates in project querydsl by querydsl.

the class NativeSQLSerializerTest method in.

@Test
public void in() {
    Configuration conf = new Configuration(new MySQLTemplates());
    NativeSQLSerializer serializer = new NativeSQLSerializer(conf, true);
    DefaultQueryMetadata md = new DefaultQueryMetadata();
    SAnimal cat = SAnimal.animal_;
    md.addJoin(JoinType.DEFAULT, cat);
    md.addWhere(cat.name.in("X", "Y"));
    md.setProjection(cat.id);
    serializer.serialize(md, false);
    assertEquals("select animal_.id\n" + "from animal_ animal_\n" + "where animal_.name in (?1, ?2)", serializer.toString());
}
Also used : MySQLTemplates(com.querydsl.sql.MySQLTemplates) SAnimal(com.querydsl.jpa.domain.sql.SAnimal) Configuration(com.querydsl.sql.Configuration) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) Test(org.junit.Test)

Example 3 with MySQLTemplates

use of com.querydsl.sql.MySQLTemplates in project querydsl by querydsl.

the class NativeSQLSerializerTest method path_column.

@Test
public void path_column() {
    PathBuilder<Entity> entity = new PathBuilder<Entity>(Entity.class, "entity");
    Configuration conf = new Configuration(new MySQLTemplates());
    NativeSQLSerializer serializer = new NativeSQLSerializer(conf, true);
    serializer.handle(entity.get("name"));
    assertEquals("entity.name", serializer.toString());
}
Also used : MySQLTemplates(com.querydsl.sql.MySQLTemplates) PathBuilder(com.querydsl.core.types.dsl.PathBuilder) Configuration(com.querydsl.sql.Configuration) Test(org.junit.Test)

Aggregations

Configuration (com.querydsl.sql.Configuration)3 MySQLTemplates (com.querydsl.sql.MySQLTemplates)3 Test (org.junit.Test)3 PathBuilder (com.querydsl.core.types.dsl.PathBuilder)2 DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)1 SAnimal (com.querydsl.jpa.domain.sql.SAnimal)1