com.gs.fw.common.mithra.finder.Operation Java Examples

The following examples show how to use com.gs.fw.common.mithra.finder.Operation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestMithraInterfaceType.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testMithraInterfaceExtendsOneMithraInterface() throws Exception
{

    final Timestamp businessDate = new Timestamp(System.currentTimeMillis());
    final Timestamp orderDate = new Timestamp(timestampFormat.parse("2004-01-12 00:00:00.0").getTime());

    DatedOrderableFinder<BitemporalOrder> baseTypeFinder = BitemporalOrderFinder.getFinderInstance();
    Operation delaredAttributesOperation = baseTypeFinder.orderDate().eq(orderDate);
    delaredAttributesOperation = delaredAttributesOperation.and(baseTypeFinder.businessDate().eq(businessDate));
    assertEquals(1, baseTypeFinder.findMany(delaredAttributesOperation).size());

    Operation inheritedAttributesOperation = baseTypeFinder.orderId().eq(1);
    inheritedAttributesOperation = inheritedAttributesOperation.and(baseTypeFinder.businessDate().eq(businessDate));
    DatedOrderable baseInterfaceType = baseTypeFinder.findOne(inheritedAttributesOperation);
    assertEquals(1, baseInterfaceType.getOrderId());

    OrderableFinder<BitemporalOrder> superTypeFinder = BitemporalOrderFinder.getFinderInstance();
    inheritedAttributesOperation = getOneOrderIdOperation(superTypeFinder, 1);
    inheritedAttributesOperation = inheritedAttributesOperation.and(baseTypeFinder.businessDate().eq(businessDate));
    Orderable orderable = superTypeFinder.findOne(inheritedAttributesOperation);
    assertEquals(1, orderable.getOrderId());

}
 
Example #2
Source File: TestNumericAttribute.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testIntDivisionPromotedToLong()
{
    Operation op = ParentNumericAttributeFinder.all();
    MithraAggregateAttribute aggrAttr = ParentNumericAttributeFinder.intAttr().dividedBy(ParentNumericAttributeFinder.longAttr()).sum();

    AggregateList aggregateList = constructAndValidateAggregateList(op, aggrAttr);

    for (int i = 0; i < aggregateList.size(); i++)
    {
        AggregateData data = aggregateList.get(i);

        switch (data.getAttributeAsInt("UserId"))
        {
            case 1:
                assertEquals(0, data.getAttributeAsLong("Attr"));
                break;
            case 2:
                assertEquals(0, data.getAttributeAsLong("Attr"));
                break;
            default:
                fail("Invalid user id");
        }
    }
}
 
Example #3
Source File: SingleColumnShortAttribute.java    From reladomo with Apache License 2.0 6 votes vote down vote up
@Override
public Operation notIn(ShortSet set)
{
    Operation op;
    switch (set.size())
    {
        case 0:
            op = new All(this);
            break;
        case 1:
            op = this.notEq(set.shortIterator().next());
            break;
        default:
            op = new ShortNotInOperation(this, set);
            break;
    }

    return op;
}
 
Example #4
Source File: TestAggregateBeanListWithPrimitives.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testMustThrowForNullPrimitiveByteResultSet()
{
    try
    {
        Operation op = NullTestFinder.all();
        AggregateBeanList<PrimitiveAggregateBean> list = new AggregateBeanList<PrimitiveAggregateBean>(op, PrimitiveAggregateBean.class);
        list.addGroupBy("testByte", NullTestFinder.noDefaultNullByte());
        list.addAggregateAttribute("manufacturerCount", NullTestFinder.notNullString().count());
        assertEquals(2, list.size());
        fail("Cannot set null value for byte type");
    }
    catch (MithraNullPrimitiveException mnpe)
    {
        assertTrue(mnpe.getMessage().contains("Aggregate result returned null"));
    }
    catch (MithraBusinessException mbe)
    {
        fail(mbe.getMessage());
    }
}
 
Example #5
Source File: TestArithmeticOperationInSearch.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testArithmeticOperationInSearchForDoubleAttribute()
throws Exception
{
    Operation op;
    ParaDesk pd;
    op = ParaDeskFinder.sizeDouble().absoluteValue().plus(ParaDeskFinder.maxFloat().absoluteValue()).eq(1581.25);
    assertEqualsAndHashCode(ParaDeskFinder.sizeDouble().absoluteValue().plus(ParaDeskFinder.maxFloat().absoluteValue()).eq(1581.25), op);
    pd = ParaDeskFinder.findOne(op);
    assertNotNull(pd);
    
    op = ParaDeskFinder.sizeDouble().absoluteValue().minus(ParaDeskFinder.maxFloat().absoluteValue()).eq(272.75);
    assertEqualsAndHashCode(ParaDeskFinder.sizeDouble().absoluteValue().minus(ParaDeskFinder.maxFloat().absoluteValue()).eq(272.75), op);
    pd = ParaDeskFinder.findOne(op);
    assertNotNull(pd);
    
    op = ParaDeskFinder.sizeDouble().absoluteValue().times(ParaDeskFinder.maxFloat().absoluteValue()).eq(606489.75);
    assertEqualsAndHashCode(ParaDeskFinder.sizeDouble().absoluteValue().times(ParaDeskFinder.maxFloat().absoluteValue()).eq(606489.75), op);
    pd = ParaDeskFinder.findOne(op);
    assertNotNull(pd);
    
    op = ParaDeskFinder.sizeDouble().absoluteValue().dividedBy(ParaDeskFinder.maxFloat()).greaterThan(1.41);
    op = op.and(ParaDeskFinder.sizeDouble().absoluteValue().dividedBy(ParaDeskFinder.maxFloat()).lessThan(1.43));
    pd = ParaDeskFinder.findOne(op);
    assertNotNull(pd);
}
 
Example #6
Source File: TestTupleIn.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testMediumTupleInWithSetAndTruncation()
{
    TupleSet set = new MithraArrayTupleTupleSet();
    set.add("7616150501", 1522);
    set.add("7616030301", 1522);
    set.add("7616030401", 1522);
    set.add("7616030601", 1522);
    set.add("7616030701", 1522);
    set.add("7616030801", 1523);
    set.add("longString12345678901234567890", 1220);
    set.add("longString12345678901234567890xyz", 1221);

    Operation op = PositionQuantityFinder.acmapCode().eq("A");
    op = op.and(PositionQuantityFinder.businessDate().eq(newTimestamp("2008-01-01 00:00:00")));
    op = op.and(PositionQuantityFinder.accountId().tupleWith(PositionQuantityFinder.productId()).in(set));
    PositionQuantityList pqList = new PositionQuantityList(op);
    assertEquals(6, pqList.size());
}
 
Example #7
Source File: TestMithraInterfaces.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testDatedRetrieval() throws Exception
{
    Operation op = BitemporalOrderWiFinder.orderId().eq(1);
    op = op.and(BitemporalOrderWiFinder.businessDate().eq(new Timestamp(System.currentTimeMillis())));
    BitemporalOrderWi order = BitemporalOrderWiFinder.findOne(op);
    assertTrue(order instanceof MithraTransactionalObject);
    assertTrue(order instanceof BitemporalOrderWiImpl);

    assertEquals(1, order.getOrderId());
    assertEquals(1, order.getUserId());
    assertEquals("First order", order.getDescription());
    assertEquals("In-Progress", order.getState());
    try
    {
        BitemporalOrderWi.class.getMethod("delete");
        fail("Should not get here");
    }
    catch(NoSuchMethodException e)
    {
        getLogger().info("Expected exception, "+BitemporalOrderWi.class.getName()+" does not have a method called \"delete\"");
    }
}
 
Example #8
Source File: TestSybaseGeneralTestCases.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testBulkInsert()
{
    final int initialId = 10000;
    final int listSize = 20;

    MithraManagerProvider.getMithraManager().executeTransactionalCommand(
            new TransactionalCommand()
            {
                public Object executeTransaction(MithraTransaction tx) throws Throwable
                {
                    ProductList productList = createNewProductList(initialId, listSize);
                    productList.insertAll();
                    tx.setBulkInsertThreshold(10);
                    return null;
                }
            }
    );
    Operation op = ProductFinder.productId().greaterThanEquals(initialId);
    ProductList list = new ProductList(op);
    assertEquals(listSize, list.size());
}
 
Example #9
Source File: TestMithraTestResourceBackwardCompatibility.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testTest() throws Exception
{
    BaseDomainTestResource testResource = new BaseDomainTestResource();
    testResource.setUp();

    MithraTestResource mtr2 = new MithraTestResource("mithraTestResource/MtrTestRuntimeConfig.xml");

    ConnectionManagerForTests connectionManager = ConnectionManagerForTests.getInstance();
    connectionManager.setDefaultSource("test_db1");
    mtr2.createSingleDatabase(connectionManager, "test_db1", "testdata/mithraTestResource/mtrTestDataForMultiSingleDb.txt");
    mtr2.setUp();

    Operation orderOp = OrderFinder.all();
    OrderList orderList = new OrderList(orderOp);
    assertEquals(4, orderList.size());

    Operation sellerOp = SellerFinder.all();
    SellerList sellerList = new SellerList(sellerOp);
    assertEquals(4, sellerList.size());

    testResource.tearDown();
    mtr2.tearDown();
}
 
Example #10
Source File: TestMin.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testAndOperationWithDifferentMappersAndCalculatedAggregateAttributeWithLinkedMapper()
{
    Set<String> zipcodeSet = new UnifiedSet(2);
    zipcodeSet.add("10001");
    zipcodeSet.add("10038");
    Operation op = SaleFinder.items().productSpecs().originalPrice().greaterThan(20.00);
    op = op.and(SaleFinder.seller().zipCode().notIn(zipcodeSet));

    MithraAggregateAttribute aggrAttr = SaleFinder.items().quantity().times(SaleFinder.items().productSpecs().originalPrice()).min();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("MinPrice", aggrAttr);
    aggregateList.addGroupBy("SellerId", SaleFinder.sellerId());
    assertEquals(1, aggregateList.size());

    AggregateData data = aggregateList.getAggregateDataAt(0);
    assertEquals(4, data.getAttributeAsInt("SellerId"));
    assertEquals(125.00, data.getAttributeAsDouble("MinPrice"), 0);

}
 
Example #11
Source File: TestDatedWithNotDatedJoin.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testNonDatedWithBusinessDateToDated() throws ParseException
{
    int dbCount = this.getRetrievalCount();
    Operation op = NotDatedWithBusinessDateFinder.quantity().greaterThan(0.5);
    op = op.and(NotDatedWithBusinessDateFinder.datedTable().exists());
    op = op.and(NotDatedWithBusinessDateFinder.businessDate().eq(new Timestamp(timestampFormat.parse("2009-01-01 00:00:00").getTime())));
    assertEquals(2, NotDatedWithBusinessDateFinder.findMany(op).size());
    if (!NotDatedWithBusinessDateFinder.getMithraObjectPortal().isPartiallyCached())
    {
        assertEquals(dbCount, this.getRetrievalCount());
    }
}
 
Example #12
Source File: TestOracleGeneralTestCases.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testRetrieveBitemporalMultiPkList()
        throws SQLException
{
    TestBalanceNoAcmapList list = testForceRefresh.insertBitemporalMulitPkAndCopyToAnotherList();
    TestBalanceNoAcmap first = list.get(0);
    Operation op = TestBalanceNoAcmapFinder.businessDate().eq(first.getBusinessDate());

    TestBalanceNoAcmapList list2 = new TestBalanceNoAcmapList(op);
    assertEquals(list.size(), list2.size());
}
 
Example #13
Source File: TestDb2GeneralTestCases.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testRetrieveOneRowUsingTimestampInOperation()
        throws ParseException
{
    Operation op = AllTypesFinder.timestampValue().eq(new Timestamp(timestampFormat.parse("2007-01-01 01:01:01.999").getTime()));
    String sql = "select " + getAllTypesColumns() + " from MITHRA.ALL_TYPES where TIMESTAMP_COL = '2007-01-01 01:01:01.999'";
    validateMithraResult(op, sql);
}
 
Example #14
Source File: TestMariaGeneralTestCases.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testDelete()
{
    int id = 9876;
    Operation op = AllTypesFinder.id().eq(id);
    AllTypes allTypes = AllTypesFinder.findOne(op);

    allTypes.delete();

    String sql = "select " + getAllTypesColumns() + " from mithra.ALL_TYPES where ID = " + id;
    validateMithraResult(op, sql, 0);

}
 
Example #15
Source File: TestCount.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testCountDateMonth()
{
    Operation op = ParaDeskFinder.all();
    MithraAggregateAttribute aggrAttr = ParaDeskFinder.closedDate().month().count();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("CountMonth", aggrAttr);
    aggregateList.addGroupBy("ActiveBoolean", ParaDeskFinder.activeBoolean());

    assertEquals(2, aggregateList.size());
    aggregateList.setAscendingOrderBy("ActiveBoolean");
    assertEquals(3, aggregateList.get(0).getAttributeAsInteger("CountMonth"));
}
 
Example #16
Source File: TestSum.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testSumTimestampDayOfMonth()
{
    Operation op = OrderFinder.all();
    MithraAggregateAttribute aggregateAttribute = OrderFinder.orderDate().dayOfMonth().sum();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("SumDayOfMonth", aggregateAttribute);
    aggregateList.addGroupBy("UserId", OrderFinder.userId());
    assertEquals(3, aggregateList.size());
    aggregateList.setAscendingOrderBy("UserId");
    assertEquals(36, aggregateList.get(0).getAttributeAsInteger("SumDayOfMonth"));
    assertEquals(12, aggregateList.get(1).getAttributeAsInteger("SumDayOfMonth"));
    assertEquals(36, aggregateList.get(2).getAttributeAsInteger("SumDayOfMonth"));
}
 
Example #17
Source File: TestAggregateWithNull.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testAggregatingAdditionCalculatedBigDecimalAttribute()
{
     Operation op = SaleFinder.all();
     MithraAggregateAttribute aggrAttr = SaleFinder.nullableBigDecimal().plus(SaleFinder.nullableVeryBigDecimal()).sum();

     AggregateList aggregateList = new AggregateList(op);
     aggregateList.addAggregateAttribute("SumCD", aggrAttr);
     aggregateList.addGroupBy("SellerId", SaleFinder.sellerId());

     assertEquals(4, aggregateList.size());

     for(int i = 0 ; i < aggregateList.size(); i ++)
     {
         AggregateData data = aggregateList.get(i);

         switch(data.getAttributeAsInt("SellerId"))
         {
             case 1:
                 assertEquals(new BigDecimal("43003.49898"), data.getAttributeAsBigDecimal("SumCD"));
                 break;
             case 2:
                 assertEquals(new BigDecimal("103558.99898"), data.getAttributeAsBigDecimal("SumCD"));
                 break;
             case 3:
                 assertEquals(new BigDecimal("80778.99999"), data.getAttributeAsBigDecimal("SumCD"));
                 break;
             case 4:
                 assertTrue( data.isAttributeNull("SumCD"));
                 break;

             default:
                 fail("Invalid seller id");
         }
     }
}
 
Example #18
Source File: TestAvg.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testMappedToManyOperationAndAggregateAttribute()
{
    Operation op = SaleFinder.items().quantity().greaterThan(15);
    com.gs.fw.common.mithra.MithraAggregateAttribute aggrAttr = SaleFinder.items().quantity().avg();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("AvgItems", aggrAttr);
    aggregateList.addGroupBy("SellerId", SaleFinder.sellerId());
    assertEquals(4, aggregateList.size());

    for (int i = 0; i < aggregateList.size(); i++)
    {
        AggregateData data = aggregateList.getAggregateDataAt(i);
        switch (data.getAttributeAsInt("SellerId"))
        {
            case 1:
                assertEquals(20, data.getAttributeAsDouble("AvgItems"), 0);
                break;
            case 2:
                assertEquals(17, data.getAttributeAsDouble("AvgItems"), 0);
                break;
            case 3:
                assertEquals(15, data.getAttributeAsDouble("AvgItems"), 0);
                break;
            case 4:
                assertEquals(15, data.getAttributeAsDouble("AvgItems"), 0);
                break;
            default:
                fail("Invalid seller id");
        }
    }

}
 
Example #19
Source File: TestDatedRelationship.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testDatedRelationShip()
    throws Exception
    {
        Operation op = DatedEntityFinder.fromZ().in(new HashSet(createDates()));
        DatedEntityFinder.clearQueryCache();
        DatedEntityList list = new DatedEntityList(op);
        list.deepFetch(DatedEntityFinder.datedEntityDesc());
        list.deepFetch(DatedEntityFinder.datedEntityDesc().datedEntityDescType());

        assertTrue(list.size()==10);

        DatedEntity dn = (DatedEntity)list.get(0);
        // todo: ryuy: add some asserts here
//        String testStr = dn.getDatedEntityDesc().getDatedEntityDescType().getType();
    }
 
Example #20
Source File: TestMax.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testMappedToManyOperationAndCalculatedAggregateAttributeWithLinkedMapper()
{
    Operation op = SaleFinder.items().quantity().greaterThan(15);
    MithraAggregateAttribute aggrAttr = SaleFinder.items().quantity().times(SaleFinder.items().productSpecs().originalPrice()).max();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("MaxPrice", aggrAttr);
    aggregateList.addGroupBy("SellerId", SaleFinder.sellerId());
    assertEquals(4, aggregateList.size());

    for (int i = 0; i < aggregateList.size(); i++)
    {
        AggregateData data = aggregateList.getAggregateDataAt(i);
        switch (data.getAttributeAsInt("SellerId"))
        {
            case 1:
                assertEquals(399.80, data.getAttributeAsDouble("MaxPrice"), 2);
                break;
            case 2:
                assertEquals(425.00, data.getAttributeAsDouble("MaxPrice"), 2);
                break;

            case 3:
                assertEquals(600.00, data.getAttributeAsDouble("MaxPrice"), 2);
                break;
            case 4:
                assertEquals(400.00, data.getAttributeAsDouble("MaxPrice"), 2);
                break;

            default:
                fail("Invalid seller id");
        }
    }

}
 
Example #21
Source File: TestSum.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void test7()
{
    Operation op = SalesLineItemFinder.sale().discountPercentage().greaterThan(0.07);
    MithraAggregateAttribute aggrAttr =
            SalesLineItemFinder.quantity().times
                    (SalesLineItemFinder.productSpecs().originalPrice()).times
                    (SalesLineItemFinder.sale().discountPercentage()).sum();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("TotalPrice", aggrAttr);
    aggregateList.addGroupBy("UserId", SalesLineItemFinder.sale().sellerId());
    assertEquals(2, aggregateList.size());
    for (int i = 0; i < aggregateList.size(); i++)
    {
        AggregateData data = aggregateList.get(i);

        switch (data.getAttributeAsInt("UserId"))
        {
            case 2:
                assertEquals(121.48, data.getAttributeAsDouble("TotalPrice"), 0.01);
                break;
            case 3:
                assertEquals(147.7, data.getAttributeAsDouble("TotalPrice"), 0.01);
                break;

            default:
                fail("Invalid sale id");
        }
    }
}
 
Example #22
Source File: TestAggregatePrimitiveBeanListWithHavingClause.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testTimestampHavingLessThanForPrimitiveBeanList() throws ParseException
{
    Timestamp ts = new Timestamp(timestampFormat.parse("2004-02-13 00:00:00.0").getTime());
    Timestamp ts3 = new Timestamp(timestampFormat.parse("2004-02-12 01:00:00.0").getTime());
    Timestamp ts4 = new Timestamp(timestampFormat.parse("2004-02-12 02:00:00.0").getTime());

    Operation op = SaleFinder.all();

    AggregateBeanList<PrimitiveAggregateBean> aggregateBeanList = new AggregateBeanList<PrimitiveAggregateBean>(op, PrimitiveAggregateBean.class);
    aggregateBeanList.addAggregateAttribute("maxSaleDate", SaleFinder.saleDate().max());
    aggregateBeanList.addGroupBy("id", SaleFinder.sellerId());
    aggregateBeanList.setHavingOperation(SaleFinder.saleDate().max().lessThan(ts));

    assertEquals(2, aggregateBeanList.size());
    for (PrimitiveAggregateBean data : aggregateBeanList)
    {
        if (data.getId() == 3)
        {
            assertEquals(ts3, data.getMaxSaleDate());
        }
        else if (data.getId() == 4)
        {
            assertEquals(ts4, data.getMaxSaleDate());
        }
        else
        {
            fail("Invalid seller id");
        }
    }
}
 
Example #23
Source File: TestAggregationWithHavingClause.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testCountAggregationWithHaving()
{
    Operation op = SalesLineItemFinder.all();

    AggregateList aggregateList = new AggregateList(op);
    aggregateList.addAggregateAttribute("TotalQty", SalesLineItemFinder.itemId().count());
    aggregateList.addGroupBy("SaleId", SalesLineItemFinder.saleId());
    aggregateList.setHavingOperation(SalesLineItemFinder.itemId().count().eq(1));

    assertEquals(1, aggregateList.size());
    AggregateData data = aggregateList.get(0);
    assertEquals(1, data.getAttributeAsInt("SaleId"));
    assertEquals(1, data.getAttributeAsInt("TotalQty"));
}
 
Example #24
Source File: TestAggregateBeanList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testCanDoAggregateAndGroupByOperationsOnBoolean()
{
    Operation op = SaleFinder.all();
    AggregateBeanList<SimpleAggregateBean> list = new AggregateBeanList<SimpleAggregateBean>(op, SimpleAggregateBean.class);
    list.addGroupBy("productId", SaleFinder.items().productId());
    list.addAggregateAttribute("maxSellerActive", SaleFinder.seller().active().max());
    list.addAggregateAttribute("minSellerActive", SaleFinder.seller().active().min());
    assertEquals(6, list.size());
}
 
Example #25
Source File: MithraAbstractObjectPortal.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private boolean requiresAnalysis(Operation op)
{
    if (op instanceof CompactUpdateCountOperation)
    {
        if (!((CompactUpdateCountOperation) op).requiresAsOfEqualityCheck())
        {
            return false;
        }
    }
    return true;
}
 
Example #26
Source File: TestAttributeUpdateWrapper.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testCharUpdateWrapper()
        throws SQLException
{
    Operation op = DifferentDataTypesFinder.id().eq(1);
    DifferentDataTypes differentDataTypes = DifferentDataTypesFinder.findOne(op);
    differentDataTypes.setCharColumn('D');

    String sql = "select * from DIFFERENT_DATA_TYPES where id = 1";
    List differentDataTypesList = new DifferentDataTypesList(DifferentDataTypesFinder.id().eq(1));
    this.genericRetrievalTest(sql, differentDataTypesList);
}
 
Example #27
Source File: TupleTempContext.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public Operation getSourceOperation(Object source, Attribute resultSourceAttribute)
{
    if (!hasSourceAttribute()) return null;
    if (tupleSourceAttribute instanceof Attribute)
    {
        return ((Attribute) tupleSourceAttribute).nonPrimitiveEq(source);
    }
    else if (tupleSourceAttribute instanceof OperationParameterExtractor)
    {
        SingleColumnAttribute tupleSrcAttribute = ((SingleColumnAttribute) resultSourceAttribute).createTupleAttribute(persistentTupleAttributes.length, this);
        tupleSrcAttribute.setColumnName(null);
        return ((Attribute) tupleSrcAttribute).nonPrimitiveEq(source);
    }
    throw new RuntimeException("Should not get here");
}
 
Example #28
Source File: TestSybaseIqGeneralTestCases.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testSingleUpdate()
{
    int id = 9876;
    Operation op = AllTypesIqFinder.id().eq(id);
    AllTypesIq allTypesIq = AllTypesIqFinder.findOne(op);
    allTypesIq.setIntValue(100);
    String sql = "select * from ALL_TYPES_IQ where ID = "+9876;
    validateMithraResult(op, sql);
}
 
Example #29
Source File: TestCursor.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void testCursorIterationNonDatedOperationBasedList() throws Exception
{
    Operation op = BookFinder.all();
    BookList list = new BookList(op);
    ClosureWithState cl = new ClosureWithState();
    list.forEachWithCursor(cl);
    this.compareList(list, cl.getResult(), bookComparator);
}
 
Example #30
Source File: TestSybaseGeneralTestCases.java    From reladomo with Apache License 2.0 5 votes vote down vote up
protected void threeLargeInClause(int setSize)
{
    IntHashSet idSet = createIntHashSet(setSize);

    AllTypesFinder.clearQueryCache();
    Operation op = AllTypesFinder.id().in(idSet).and(AllTypesFinder.intValue().in(idSet)).and(AllTypesFinder.nullableIntValue().in(idSet));
    AllTypesFinder.findMany(op).forceResolve();
}