java.lang.Object
net.sf.persism.SQL
Simple wrapper for SQL String. Mainly to allow for overloads to fetch/query methods.
- See Also:
-
Method Summary
-
Method Details
-
sql
Method to instantiate a regular SQL string.Contact> contact; contact = session.fetch(Contact.class, sql("SELECT * FROM CONTACTS WHERE LAST_NAME = ? AND FIRST_NAME = ?"), params("Fred", "Flintstone");
- Parameters:
sql
- String- Returns:
- new SQL object
-
where
Method used to specify an SQL WHERE clause for an SQL Statement. The SELECT ... parts would be provided by Persism. Only here do we allow property names in the queryList<Contact> contacts; contacts = session.query(Contact.class, where("(:firstname = @name OR :company = @name) and :lastname = @last and :city = @city and :amountOwed > @owe ORDER BY :dateAdded"), named(Map.of("name", "Fred", "last", "Flintstone", "owe", 10, "city", "Somewhere")));
- Parameters:
where
- String- Returns:
- new SQL object
-
proc
Static initializer for a new SQL stored procedure string.List<CustomerOrder> list; list = session.query(CustomerOrder.class, proc("[spCustomerOrders](?)"), params("123"));
- Parameters:
storedProc
- String- Returns:
- new SQL object
-