By default, database queries in RapidClipse are performed in the data access layer (Project Management > Data Access). Thus, database queries are separated from UI entities and business logic. For each entity, a corresponding data access object (DAO) is available in the data access layer (standard when entities are created and imported). The DAO acts as the interface to the database. The database query itself is performed by using a custom method that is invoked on the DAO. This method queries the database and returns the query result. The DAO also provides some standard methods.
Standard query methods
Query all records related to the DAO object in use: .findAll ();
Query a particular object by using the primary key: .find(Object primaryKey).
Return a list of objects that fit the given example - .findByExample(Class entity, Object example)
ATTENTION: Even the 0 or "" (empty string) default values are tested. Therefore, all values should be filled with the null value at a minimum.
Manually abort the transaction with subsequent rollback: .rollback ().
Save the created entities: .save (Object entity).