Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fluent APIs example
package fluent;
public class ObjectWikiExample {
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) {
List<Books> books = FromDatabase(dbConn).select(Book.class).with("cover", equal("red")).with("author", like("%Wendt")).fetchAll();
for (Book book : books) {
System.out.println(book);
}
}
}
package traditional.generics;
public class ObjectWikiExample {
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) {
ObjectWikiQuery<Book> query = databaseConnection.createQuery(Book.class);
query.addConstraint("cover", "red");
query.addConstraint("author", "%Wendt");
List<Book> books = query.fetchAll();
for (Book book : books) {
System.out.println(book);
}
}
}
package traditional.raw;
public class ObjectWikiExample {
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) {
ObjectWikiQuery query = databaseConnection.createQuery();
query.setType("book");
query.addConstraint("cover", "red");
query.addConstraint("author", "%Wendt");
List<Book> books = (List<Book>) query.fetchAll();
for (Book book : books) {
System.out.println(book);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.