Class Parameters

java.lang.Object
net.sf.persism.Parameters

public final class Parameters extends Object
Helper Class to represent parameters to a query.
  • Method Details

    • params

      public static Parameters params(Object... values)
      Static initializer for a new set of Parameters.
      
            Employee employee = session.fetch(Employee.class, sql("SELECT * FROM Employees WHERE LastName=? and FirstName=?"), params("Leverling", "Janet"));
       
      Parameters:
      values - varargs list of arbitrary parameters for a query.
      Returns:
      new Parameters object
    • params

      public static Parameters params(Map<String,Object> nameValuePair)
      Static initializer for named parameters.
      
            List<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"),
                       params(Map.of("name", "Fred", "last", "Flintstone", "owe", 10, "city", "Somewhere")));
       
      Parameters:
      nameValuePair - - use Map.of("key1", value, "key2", value) etc.
      Returns:
      new Parameters object
    • none

      public static Parameters none()
      Represents no Parameters.
      Returns:
      empty array instance of Parameters