use of org.apache.cayenne.testdo.quotemap.QuoteAdress in project cayenne by apache.
the class QuotedIdentifiersIT method testPrefetchQuote.
@Test
public void testPrefetchQuote() {
DbEntity entity = context.getEntityResolver().getObjEntity(QuoteAdress.class).getDbEntity();
List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("City"));
List<DbAttribute> updatedAttributes = Collections.singletonList(entity.getAttribute("City"));
UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes, Collections.emptySet(), 1);
List objects3 = context.performQuery(updateQuery);
assertEquals(0, objects3.size());
List<Quote_Person> objects4 = ObjectSelect.query(Quote_Person.class).select(context);
assertEquals(2, objects4.size());
List<Quote_Person> objects5 = ObjectSelect.query(Quote_Person.class, Quote_Person.SALARY.eq(100)).select(context);
assertEquals(1, objects5.size());
List<Quote_Person> objects6 = ObjectSelect.query(Quote_Person.class, Quote_Person.GROUP.eq("107324")).select(context);
assertEquals(1, objects6.size());
List<QuoteAdress> objects7 = ObjectSelect.query(QuoteAdress.class, QuoteAdress.GROUP.eq("324")).select(context);
assertEquals(1, objects7.size());
ObjectIdQuery queryObjectId = new ObjectIdQuery(ObjectId.of("QuoteAdress", QuoteAdress.GROUP.getName(), "324"));
List objects8 = context.performQuery(queryObjectId);
assertEquals(1, objects8.size());
ObjectIdQuery queryObjectId2 = new ObjectIdQuery(ObjectId.of("Quote_Person", "GROUP", "1111"));
List objects9 = context.performQuery(queryObjectId2);
assertEquals(1, objects9.size());
Quote_Person quote_Person2 = ObjectSelect.query(Quote_Person.class, Quote_Person.NAME.eq("Name")).selectOne(context);
RelationshipQuery relationshipQuery = new RelationshipQuery(quote_Person2.getObjectId(), "address_Rel");
List objects10 = context.performQuery(relationshipQuery);
assertEquals(1, objects10.size());
}
use of org.apache.cayenne.testdo.quotemap.QuoteAdress in project cayenne by apache.
the class QuotedIdentifiersIT method testInsert.
@Test
public void testInsert() {
QuoteAdress quoteAdress = context.newObject(QuoteAdress.class);
quoteAdress.setCity("city");
quoteAdress.setGroup("324");
Quote_Person quote_Person = context.newObject(Quote_Person.class);
quote_Person.setSalary(10000);
quote_Person.setName("Arcadi");
quote_Person.setGroup("107324");
quote_Person.setAddress_Rel(quoteAdress);
context.commitChanges();
QuoteAdress quoteAdress2 = context.newObject(QuoteAdress.class);
quoteAdress2.setCity("city2");
Quote_Person quote_Person2 = context.newObject(Quote_Person.class);
quote_Person2.setSalary(100);
quote_Person2.setName("Name");
quote_Person2.setGroup("1111");
quote_Person2.setDAte(new Date());
quote_Person2.setAddress_Rel(quoteAdress2);
context.commitChanges();
List<QuoteAdress> objects = ObjectSelect.query(QuoteAdress.class).select(context);
assertEquals(4, objects.size());
List<Quote_Person> objects2 = ObjectSelect.query(Quote_Person.class).select(context);
assertEquals(4, objects2.size());
}
use of org.apache.cayenne.testdo.quotemap.QuoteAdress in project cayenne by apache.
the class QuotedIdentifiersIT method setUp.
@Before
public void setUp() throws Exception {
QuoteAdress quoteAdress = context.newObject(QuoteAdress.class);
quoteAdress.setCity("city");
quoteAdress.setGroup("324");
Quote_Person quote_Person = context.newObject(Quote_Person.class);
quote_Person.setSalary(10000);
quote_Person.setName("Arcadi");
quote_Person.setGroup("107324");
quote_Person.setAddress_Rel(quoteAdress);
context.commitChanges();
QuoteAdress quoteAdress2 = context.newObject(QuoteAdress.class);
quoteAdress2.setCity("city2");
Quote_Person quote_Person2 = context.newObject(Quote_Person.class);
quote_Person2.setSalary(100);
quote_Person2.setName("Name");
quote_Person2.setGroup("1111");
quote_Person2.setDAte(new Date());
quote_Person2.setAddress_Rel(quoteAdress2);
context.commitChanges();
}
Aggregations