Examples of Test2Factory


Examples of org.jooq.util.maven.example.mysql.Test2Factory

    @Test
    public void testInstanceModel() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test2", "root", "");
        Test2Factory create = new Test2Factory(connection);

        TBook b = T_BOOK.as("b");
        TAuthor a = T_AUTHOR.as("a");
        TBookStore s = T_BOOK_STORE.as("s");
        TBookToBookStore t = T_BOOK_TO_BOOK_STORE.as("t");

        Result<Record> result =
        create.select(a.FIRST_NAME, a.LAST_NAME, countDistinct(s.NAME))
              .from(a)
              .join(b).on(b.AUTHOR_ID.equal(a.ID))
              .join(t).on(t.BOOK_ID.equal(b.ID))
              .join(s).on(t.BOOK_STORE_NAME.equal(s.NAME))
              .groupBy(a.FIRST_NAME, a.LAST_NAME)
View Full Code Here

Examples of org.jooq.util.maven.example.mysql.Test2Factory

    @Test
    public void testCustomEnum() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test2", "root", "");
        Test2Factory create = new Test2Factory(connection);

        create.delete(T_BOOLEANS).execute();

        assertEquals(1,
        create.insertInto(T_BOOLEANS)
              .set(T_BOOLEANS.ID, 1)
              .set(T_BOOLEANS.ONE_ZERO, Boolean_10._0)
              .set(T_BOOLEANS.TRUE_FALSE_LC, BooleanTrueFalseLc.true_)
              .set(T_BOOLEANS.TRUE_FALSE_UC, BooleanTrueFalseUc.FALSE)
              .set(T_BOOLEANS.Y_N_LC, BooleanYnLc.y)
              .set(T_BOOLEANS.Y_N_UC, BooleanYnUc.N)
              .set(T_BOOLEANS.YES_NO_LC, BooleanYesNoLc.yes)
              .set(T_BOOLEANS.YES_NO_UC, BooleanYesNoUc.NO)
              .execute());

        TBooleansRecord bool = create.selectFrom(T_BOOLEANS).fetchOne();
        assertEquals(1, (int) bool.getId());
        assertEquals(Boolean_10._0, bool.getOneZero());
        assertEquals(BooleanTrueFalseLc.true_, bool.getTrueFalseLc());
        assertEquals(BooleanTrueFalseUc.FALSE, bool.getTrueFalseUc());
        assertEquals(BooleanYnLc.y, bool.getYNLc());
        assertEquals(BooleanYnUc.N, bool.getYNUc());
        assertEquals(BooleanYesNoLc.yes, bool.getYesNoLc());
        assertEquals(BooleanYesNoUc.NO, bool.getYesNoUc());

        assertEquals(1,
        create.delete(T_BOOLEANS).execute());
    }
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.