Package com.mysema.query.sql.mysql

Examples of com.mysema.query.sql.mysql.MySQLQuery


//         FOR UPDATE
//          OF FIRST_NAME, LAST_NAME

        QAuthor author = QAuthor.author;
        QBook book = QBook.book;
        MySQLQuery query = new MySQLQuery(null);
        query.from(author)
           .join(book).on(author.id.eq(book.authorId))
           .where(book.language.eq("DE"), book.published.eq(new Date()))
           .groupBy(author.firstName, author.lastName)
           .having(Wildcard.count.gt(5))
           .orderBy(author.lastName.asc())
           .limit(2)
           .offset(1)
           .forUpdate();
           // of(author.firstName, author.lastName)

        query.getMetadata().addProjection(author.firstName);
        query.getMetadata().addProjection(author.lastName);
        query.getMetadata().addProjection(Wildcard.count);

        SQLSerializer serializer = new SQLSerializer(new Configuration(new MySQLTemplates()));
        serializer.serialize(query.getMetadata(), false);

        assertEquals("select author.FIRST_NAME, author.LAST_NAME, count(*)\n"+
                     "from AUTHOR author\n"+
                     "join BOOK book\n"+
                     "on author.ID = book.AUTHOR_ID\n"+
View Full Code Here



public class SelectMySQLBase extends AbstractBaseTest {

    protected MySQLQuery mysqlQuery() {
        return new MySQLQuery(connection, configuration);
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.sql.mysql.MySQLQuery

Copyright © 2018 www.massapicom. 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.