Search in sources :

Example 41 with DatabaseObject

use of com.bluenimble.platform.db.DatabaseObject in project serverless by bluenimble.

the class FindAllWithSelect method main.

public static void main(String[] args) throws Exception {
    String query = "{ select: [name], orderBy: { name: asc } }";
    Database db = new DatabaseServer().get();
    List<DatabaseObject> employees = db.find("Employees", new JsonQuery(new JsonObject(query)), null);
    for (DatabaseObject employee : employees) {
        System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
    }
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

Example 42 with DatabaseObject

use of com.bluenimble.platform.db.DatabaseObject in project serverless by bluenimble.

the class FindAllWithSort method main.

public static void main(String[] args) throws Exception {
    String query = "{ orderBy: { name: asc } }";
    Database db = new DatabaseServer().get();
    List<DatabaseObject> employees = db.find("Employees", new JsonQuery(new JsonObject(query)), null);
    for (DatabaseObject employee : employees) {
        System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
    }
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

Aggregations

DatabaseObject (com.bluenimble.platform.db.DatabaseObject)42 Database (com.bluenimble.platform.db.Database)37 JsonObject (com.bluenimble.platform.json.JsonObject)29 DefaultDatabaseObjectSerializer (com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer)20 JsonQuery (com.bluenimble.platform.db.query.impls.JsonQuery)16 ApiServiceExecutionException (com.bluenimble.platform.api.ApiServiceExecutionException)9 JsonApiOutput (com.bluenimble.platform.api.impls.JsonApiOutput)9 DatabaseException (com.bluenimble.platform.db.DatabaseException)6 JsonArray (com.bluenimble.platform.json.JsonArray)6 ApiAccessDeniedException (com.bluenimble.platform.api.ApiAccessDeniedException)4 ApiOutput (com.bluenimble.platform.api.ApiOutput)4 ApiSpace (com.bluenimble.platform.api.ApiSpace)4 Date (java.util.Date)4 HashMap (java.util.HashMap)3 Config (com.bluenimble.platform.api.impls.im.LoginServiceSpi.Config)2 ApiAuthenticationException (com.bluenimble.platform.api.security.ApiAuthenticationException)2 Messenger (com.bluenimble.platform.messaging.Messenger)2 JsonRecipient (com.bluenimble.platform.messaging.impls.JsonRecipient)2 JsonSender (com.bluenimble.platform.messaging.impls.JsonSender)2 OIntentMassiveInsert (com.orientechnologies.orient.core.intent.OIntentMassiveInsert)1