protected void setUp() throws Exception {
deleteTestData();
}
public void testAliasPathSplits_SinglePath() {
ObjectContext context = createDataContext();
context.performGenericQuery(new SQLTemplate(
Artist.class,
"INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (1, 'AA')"));
context.performGenericQuery(new SQLTemplate(
Artist.class,
"INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (2, 'BB')"));
context.performGenericQuery(new SQLTemplate(
Artist.class,
"INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) "
+ "VALUES (1, 1, 'X')"));
context.performGenericQuery(new SQLTemplate(
Artist.class,
"INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE)"
+ " VALUES (2, 2, 'Y')"));
SelectQuery query = new SelectQuery(Artist.class);
query.andQualifier(ExpressionFactory.matchExp("p.paintingTitle", "X"));
query.aliasPathSplits("paintingArray", "p");
List<Artist> artists = context.performQuery(query);
assertEquals(1, artists.size());
assertEquals("AA", artists.get(0).getArtistName());
}