Class DataEntityDAO

java.lang.Object
fr.paris.lutece.portal.business.datastore.DataEntityDAO
All Implemented Interfaces:
IDataEntityDAO

public final class DataEntityDAO extends Object implements IDataEntityDAO
This class provides Data Access methods for Entity objects
  • Constructor Details

    • DataEntityDAO

      public DataEntityDAO()
  • Method Details

    • insert

      public void insert(DataEntity entity)
      Insert a new record in the table.
      Specified by:
      insert in interface IDataEntityDAO
      Parameters:
      entity - instance of the Entity object to insert
    • insertIfAbsent

      public boolean insertIfAbsent(DataEntity entity)
      Atomically inserts a new record only if no record with the same primary key already exists. Relies on the database-level primary key uniqueness constraint, which makes the operation safe under concurrent calls from multiple application instances (multi-instance deployment).

      Portable across SQL databases (MariaDB, PostgreSQL, Oracle, H2...) — does not use vendor-specific syntax like ON CONFLICT or INSERT IGNORE.

      Specified by:
      insertIfAbsent in interface IDataEntityDAO
      Parameters:
      entity - instance of the Entity object to insert
      Returns:
      true if the row was inserted, false if a row with the same key already existed
    • load

      public DataEntity load(String strKey)
      Load the data of the entity from the table
      Specified by:
      load in interface IDataEntityDAO
      Parameters:
      strKey - The identifier of the entity
      Returns:
      the instance of the Entity
    • delete

      public void delete(String strKey)
      Delete a record from the table
      Specified by:
      delete in interface IDataEntityDAO
      Parameters:
      strKey - The identifier of the entity
    • store

      public void store(DataEntity entity)
      Update the record in the table
      Specified by:
      store in interface IDataEntityDAO
      Parameters:
      entity - The reference of the entity
    • selectEntitiesList

      public List<DataEntity> selectEntitiesList()
      Load the data of all the entitys and returns them as a List
      Specified by:
      selectEntitiesList in interface IDataEntityDAO
      Returns:
      The List which contains the data of all the entitys
    • selectEntitiesByPrefix

      public List<DataEntity> selectEntitiesByPrefix(String strPrefix)
      Description copied from interface: IDataEntityDAO
      Load the data of all the entity objects whose key share a prefix
      Specified by:
      selectEntitiesByPrefix in interface IDataEntityDAO
      Parameters:
      strPrefix - the prefix
      Returns:
      the list which contains the data of all the entity objects whose key share a prefix