Interface Persistable


public interface Persistable
This interface indicates that the implementing class can be persisted in permanent storage.
Author:
Lennart Martens
  • Method Summary

    Modifier and Type
    Method
    Description
    This method will return the automatically generated key for the insert if one was triggered, or 'null' otherwise.
    int
    This method can be called to store the implemnted objects state to a persistent store for the first time (equivalent to SQL 'INSERT').
  • Method Details

    • persist

      int persist(Connection aConn) throws SQLException
      This method can be called to store the implemnted objects state to a persistent store for the first time (equivalent to SQL 'INSERT').
      Parameters:
      aConn - The Connection on which to execute SQL statements. It should be an open connection and the implementation should refrain from closing it, so the caller can reuse it.
      Returns:
      int with the number of affected rows.
      Throws:
      SQLException - When the insert fails (e.g.: connection gone stale).
    • getGeneratedKeys

      Object[] getGeneratedKeys()
      This method will return the automatically generated key for the insert if one was triggered, or 'null' otherwise.
      Returns:
      Object[] with the generated keys.