Package org.apache.torque.criteria

Examples of org.apache.torque.criteria.Criteria


            return;
        }

        cleanBookstore();
        insertTestData();
        Criteria criteria = new Criteria();
        criteria.addAlias("b", BookPeer.TABLE_NAME);
        criteria.addJoin(BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID,
                Criteria.RIGHT_JOIN);
        criteria.addJoin(
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()),
                AuthorPeer.AUTHOR_ID,
                Criteria.RIGHT_JOIN);

        List<Author> authorList = AuthorPeer.doSelect(criteria);
View Full Code Here


        }

        cleanBookstore();
        insertTestData();

        Criteria subselect = new Criteria();
        BookPeer.addSelectColumns(subselect);
        subselect.where(BookPeer.TITLE, "Book 1");

        Criteria criteria = new Criteria();
        criteria.addAlias("b", subselect);
        criteria.addJoin(
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()),
                AuthorPeer.AUTHOR_ID);

        List<Author> authorList = AuthorPeer.doSelect(criteria);
View Full Code Here

     */
    public void testBooleanTrueSelect() throws Exception
    {
        fillTables();

        Criteria criteria = new Criteria()
                .where(BintBcharTypePeer.BCHAR_VALUE, new Boolean(true))
                .and(BintBcharTypePeer.BINT_VALUE, new Boolean(true))
                .and(BintBcharTypePeer.BCHAR_OBJECT_VALUE, new Boolean(true))
                .and(BintBcharTypePeer.BINT_OBJECT_VALUE, new Boolean(true));
        List<BintBcharType> selectedList
View Full Code Here

     */
    public void testBooleanFalseSelect() throws Exception
    {
        fillTables();

        Criteria criteria = new Criteria()
                .where(BintBcharTypePeer.BCHAR_VALUE, new Boolean(false))
                .and(BintBcharTypePeer.BINT_VALUE, new Boolean(false))
                .and(BintBcharTypePeer.BCHAR_OBJECT_VALUE, new Boolean(false))
                .and(BintBcharTypePeer.BINT_OBJECT_VALUE, new Boolean(false));
        List<BintBcharType> selectedList
View Full Code Here

     */
    public void testImplicitInnerJoinTwoConditions() throws Exception
    {
        cleanBookstore();
        insertTestData();
        Criteria criteria = new Criteria();
        Criterion joinCondition = new Criterion(AuthorPeer.AUTHOR_ID,
                BookPeer.AUTHOR_ID);
        joinCondition.and(new Criterion(BookPeer.TITLE, "Book 1"));
        criteria.addJoin(
                AuthorPeer.TABLE_NAME,
                BookPeer.TABLE_NAME,
                joinCondition,
                null);

View Full Code Here

     */
    public void testBooleanObjectNullSelect() throws Exception
    {
        fillTables();

        Criteria criteria = new Criteria()
                .where(BintBcharTypePeer.BCHAR_OBJECT_VALUE, null)
                .and(BintBcharTypePeer.BINT_OBJECT_VALUE, null);
        List<BintBcharType> selectedList
                = BintBcharTypePeer.doSelect(criteria);
        assertEquals(1, selectedList.size());
View Full Code Here

     */
    public void testPrimitiveNullSelect() throws Exception
    {
        fillTables();

        Criteria criteria = new Criteria()
                .and(BintBcharTypePeer.BCHAR_VALUE, null)
                .and(BintBcharTypePeer.BINT_VALUE, null);
        List<BintBcharType> selectedList
                = BintBcharTypePeer.doSelect(criteria);
        assertTrue("Should have read 0 dataset with both values false "
View Full Code Here

     */
    public void testExplicitInnerJoinTwoConditions() throws Exception
    {
        cleanBookstore();
        insertTestData();
        Criteria criteria = new Criteria();
        Criterion joinCondition = new Criterion(AuthorPeer.AUTHOR_ID,
                BookPeer.AUTHOR_ID);
        joinCondition.and(new Criterion(BookPeer.TITLE, "Book 1"));
        criteria.addJoin(
                AuthorPeer.TABLE_NAME,
                BookPeer.TABLE_NAME,
                joinCondition,
                Criteria.INNER_JOIN);

View Full Code Here

     */
    public void testBooleanSelectViaJoins() throws Exception
    {
        fillTables();

        Criteria criteria = new Criteria();
        criteria.addAlias("bc", BintBcharTypePeer.TABLE_NAME);
        criteria.addJoin(
                BintBcharTypePeer.ID,
                new ColumnImpl("bc.id"));
        criteria.where(new ColumnImpl("bc.BINT_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BCHAR_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BINT_OBJECT_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BCHAR_OBJECT_VALUE"), new Boolean(false));
        List<BintBcharType> selectedList
                = BintBcharTypePeer.doSelect(criteria);
View Full Code Here

    public void testDoSelectJoinY() throws Exception
    {
        cleanBookstore();
        insertTestData();

        Criteria criteria = new Criteria();
        criteria.addAscendingOrderByColumn(BookPeer.TITLE);

        List<Book> books = BookPeer.doSelectJoinAuthor(criteria);

        assertTrue("books should contain 4 books but contains "
                + books.size(), books.size() == 4);
View Full Code Here

TOP

Related Classes of org.apache.torque.criteria.Criteria

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.