Class ConfiguracionDAO


  • public class ConfiguracionDAO
    extends BaseDAO<Configuracion>
    Data Access Object for the Configuraciones table Handles database operations for configuration entities
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean existsByName​(java.lang.String nombre)
      Checks if a configuration with the given name already exists
      protected java.lang.String[] getColumnNames()
      Gets the column names for the Configuraciones table
      int getIdByNombre​(java.lang.String nombre)
      Retrieves the ID of a configuration by its name
      protected java.lang.String getTableName()
      Gets the name of the database table
      protected Configuracion mapResultSetToEntity​(java.sql.ResultSet rs)
      Maps a ResultSet row to a Configuracion entity
      protected void setPreparedStatementParams​(java.sql.PreparedStatement ps, Configuracion entity)
      Sets the parameters for a PreparedStatement based on Configuracion properties
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfiguracionDAO

        public ConfiguracionDAO()
    • Method Detail

      • getTableName

        protected java.lang.String getTableName()
        Gets the name of the database table
        Specified by:
        getTableName in class BaseDAO<Configuracion>
        Returns:
        The table name "configuraciones"
      • getColumnNames

        protected java.lang.String[] getColumnNames()
        Gets the column names for the Configuraciones table
        Specified by:
        getColumnNames in class BaseDAO<Configuracion>
        Returns:
        Array of column names
      • mapResultSetToEntity

        protected Configuracion mapResultSetToEntity​(java.sql.ResultSet rs)
                                              throws java.sql.SQLException
        Maps a ResultSet row to a Configuracion entity
        Specified by:
        mapResultSetToEntity in class BaseDAO<Configuracion>
        Parameters:
        rs - The ResultSet containing the database row
        Returns:
        A new Configuracion object with data from the ResultSet
        Throws:
        java.sql.SQLException - if a database error occurs
      • setPreparedStatementParams

        protected void setPreparedStatementParams​(java.sql.PreparedStatement ps,
                                                  Configuracion entity)
                                           throws java.sql.SQLException
        Sets the parameters for a PreparedStatement based on Configuracion properties
        Specified by:
        setPreparedStatementParams in class BaseDAO<Configuracion>
        Parameters:
        ps - The PreparedStatement to set parameters for
        entity - The Configuracion entity containing the values to set
        Throws:
        java.sql.SQLException - if a database error occurs
      • getIdByNombre

        public int getIdByNombre​(java.lang.String nombre)
                          throws java.sql.SQLException
        Retrieves the ID of a configuration by its name
        Parameters:
        nombre - The name of the configuration
        Returns:
        The ID of the configuration, or -1 if not found
        Throws:
        java.sql.SQLException - if a database error occurs
      • existsByName

        public boolean existsByName​(java.lang.String nombre)
                             throws java.sql.SQLException
        Checks if a configuration with the given name already exists
        Parameters:
        nombre - The name of the configuration to check
        Returns:
        true if a configuration with the name exists, false otherwise
        Throws:
        java.sql.SQLException - if a database error occurs