mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-19 21:00:53 +08:00
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package com.mysema.query.sql;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import org.junit.Test;
|
|
|
|
import com.mysema.query.sql.AbstractSQLQuery.UnionBuilder;
|
|
import com.mysema.query.types.path.PSimple;
|
|
|
|
|
|
|
|
public class OracleTemplatesTest extends AbstractSQLTemplatesTest{
|
|
|
|
@Override
|
|
protected SQLTemplates createTemplates() {
|
|
return new OracleTemplates();
|
|
}
|
|
|
|
@Test
|
|
public void union(){
|
|
PSimple<Integer> one = new PSimple<Integer>(Integer.class,"1");
|
|
PSimple<Integer> two = new PSimple<Integer>(Integer.class,"2");
|
|
PSimple<Integer> three = new PSimple<Integer>(Integer.class,"3");
|
|
PSimple<Integer> col1 = new PSimple<Integer>(Integer.class,"col1");
|
|
UnionBuilder union = query.union(
|
|
sq().unique(one.as(col1)),
|
|
sq().unique(two),
|
|
sq().unique(three));
|
|
assertEquals(
|
|
"(select 1 col1 from dual) " +
|
|
"union " +
|
|
"(select 2 from dual) " +
|
|
"union " +
|
|
"(select 3 from dual)", union.toString());
|
|
}
|
|
|
|
|
|
}
|