Examples of StringPath


Examples of com.mysema.query.types.path.StringPath

        assertNotNull(conversions.newInstance(1, 2));
    }

    @Test
    public void Number_Conversion() {
        StringPath strPath = new StringPath("strPath");
        NumberPath<Integer> intPath = new NumberPath<Integer>(Integer.class, "intPath");
        QTuple qTuple = new QTuple(strPath, intPath);
        NumberConversions<Tuple> conversions = new NumberConversions<Tuple>(qTuple);
        Tuple tuple = conversions.newInstance("a", Long.valueOf(3));
        assertEquals("a", tuple.get(strPath));
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

        query().from(survey).where(survey.name.in(Arrays.asList("a","b","c"))).count();
    }

    @Test
    public void Precedence() {
        StringPath fn = employee.firstname;
        StringPath ln = employee.lastname;
        Predicate where = fn.eq("Mike").and(ln.eq("Smith")).or(fn.eq("Joe").and(ln.eq("Divis")));
        assertEquals(2l, query().from(employee).where(where).count());
    }
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

        assertEquals(2l, query().from(employee).where(where).count());
    }

    @Test
    public void Precedence2() {
        StringPath fn = employee.firstname;
        StringPath ln = employee.lastname;
        Predicate where = fn.eq("Mike").and(ln.eq("Smith").or(fn.eq("Joe")).and(ln.eq("Divis")));
        assertEquals(0l, query().from(employee).where(where).count());
    }
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

    @Test
    public void DynamicQuery() {
        Path<Object> userPath = Expressions.path(Object.class, "user");
        NumberPath<Long> idPath = Expressions.numberPath(Long.class, userPath, "id");
        StringPath usernamePath = Expressions.stringPath(userPath, "username");
        Expression<?> sq = new SQLSubQuery()
            .from(userPath).where(idPath.eq(1l))
            .list(idPath, usernamePath);

        SQLSerializer serializer = new SQLSerializer(Configuration.DEFAULT);
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

    @Test
    public void DynamicQuery2() {
        PathBuilder<Object> userPath = new PathBuilder<Object>(Object.class, "user");
        NumberPath<Long> idPath = userPath.getNumber("id", Long.class);
        StringPath usernamePath = userPath.getString("username");
        Expression<?> sq = new SQLSubQuery()
            .from(userPath).where(idPath.eq(1l))
            .list(idPath, usernamePath);

        SQLSerializer serializer = new SQLSerializer(Configuration.DEFAULT);
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

    private QueryMetadata metadata = new DefaultQueryMetadata();

    @Test
    public void Serialization() throws IOException, ClassNotFoundException{
        StringPath expr = new StringPath("str");
        metadata.addJoin(JoinType.DEFAULT, expr);
        metadata.addFlag(new QueryFlag(Position.AFTER_FILTERS, ""));
        metadata.addGroupBy(expr);
        metadata.addHaving(expr.isEmpty());       
//        metadata.getJoins().get(0).addFlag(new JoinFlag(""));
        metadata.addJoinCondition(expr.isEmpty());
        metadata.addOrderBy(expr.asc());
        metadata.addProjection(expr);
        metadata.addWhere(expr.isEmpty());
       
        // serialize metadata
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(baos);
        out.writeObject(metadata);
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

public class PrecedenceTest {
   
    @Test
    public void test() {
        StringPath str1 = new StringPath("str1");
        StringPath str2 = new StringPath("str2");
        BooleanExpression pending = str1.eq("3").and(str2.eq("1"));
        BooleanExpression notNew = str1.ne("1").and(str2.in("2", "3"));      
        BooleanExpression whereClause = str1.eq("a").and(pending.or(notNew));
        String str = new SQLSerializer(Configuration.DEFAULT).handle(whereClause).toString();
        assertEquals("str1 = ? and (str1 = ? and str2 = ? or str1 != ? and str2 in (?, ?))", str);
    }
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

        String var = "var"+ arg.getClass().getSimpleName() + "_" + arg.toString().replace(' ', '_');
        return new PathBuilder<D>((Class)arg.getClass(), var);
    }

    public static StringPath var(String arg) {
        return new StringPath(arg.replace(' ', '_'));
    }
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

   
    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Before
    public void setUp() {
        num = new NumberPath<Integer>(Integer.class, "num");
        str = new StringPath("str");
        date = new DatePath<Date>(Date.class, "date");
        QueryMixin query = new QueryMixin();
        query.from(num, str);
        sub = new DetachableMixin(query);
    }
View Full Code Here

Examples of com.mysema.query.types.path.StringPath

    @Test
    @SuppressWarnings("unchecked")
    public void test() {
        DummyQuery query = new DummyQuery();
        DummyProjectable projectable = new DummyProjectable();
        SimpleProjectableAdapter simpleQuery = new SimpleProjectableAdapter(query, projectable, new StringPath("a"));
       
        simpleQuery.count();
        simpleQuery.distinct().count();
        assertNotNull(simpleQuery.list());
        assertNotNull(simpleQuery.distinct().list());
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.