package de.linwave.junit.nativequery;
import org.odbms.ObjectSet;
import org.odbms.Predicate;
import org.odbms.Query;
import de.linwave.junit.AbstractTestCase;
import de.linwave.music.Album;
import de.linwave.music.Artist;
import de.linwave.music.Band;
import de.linwave.music.Track;
public class NativeQueryMusic extends AbstractTestCase
{
private static boolean initialized = false;
private static int rows;
@Override
protected void setUp() throws Exception
{
super.setUp();
}
public void testBandsWithArtist()
{
Query query = db.query(new Predicate<Band>() {
public boolean match(Band band)
{
return band.getAritsts().size() > 2;
}
});
ObjectSet<Band> bands = query.execute();
}
/**
*
*/
public void artists()
{
Query query = db.query(new Predicate<Artist>() {
public boolean match(Artist artist)
{
return artist.getName().equals("John Lennon");
}
});
ObjectSet<Band> artists = query.execute();
}
/**
*
*/
public void testAlbumWithClock()
{
Query query = db.query(new Predicate<Album>() {
public boolean match(Album album)
{
return album.getName().startsWith("Clock");
}
});
ObjectSet<Album> albums = query.execute();
for (Album album : albums) {
}
}
/**
*
*/
public void testTrackNameContainsRoad()
{
Query query = db.query(new Predicate<Track>() {
public boolean match(Track track)
{
return track.getTitle().contains("road");
}
});
ObjectSet<Track> tracks = query.execute();
}
}