Class TiposComponenteDAO


  • public class TiposComponenteDAO
    extends BaseDAO<TipoComponente>
    Data Access Object for managing component types in the database. Handles CRUD operations for the TiposComponente table, which stores different categories of network components (e.g., cables, amplifiers, splitters).
    • Constructor Detail

      • TiposComponenteDAO

        public TiposComponenteDAO()
    • Method Detail

      • getTableName

        protected java.lang.String getTableName()
        Returns the name of the database table for component types.
        Specified by:
        getTableName in class BaseDAO<TipoComponente>
        Returns:
        The table name "tipos_componente"
      • getColumnNames

        protected java.lang.String[] getColumnNames()
        Returns the column names for the TiposComponente table.
        Specified by:
        getColumnNames in class BaseDAO<TipoComponente>
        Returns:
        Array containing "id_tipos_componente", "nombre", and "descripcion"
      • mapResultSetToEntity

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

        protected void setPreparedStatementParams​(java.sql.PreparedStatement ps,
                                                  TipoComponente entity)
                                           throws java.sql.SQLException
        Sets the parameters for database operations using a TipoComponente entity.
        Specified by:
        setPreparedStatementParams in class BaseDAO<TipoComponente>
        Parameters:
        ps - The PreparedStatement to set parameters for
        entity - The TipoComponente entity containing the data
        Throws:
        java.sql.SQLException - if there is an error setting the parameters
      • getIdByNombre

        public int getIdByNombre​(java.lang.String nombre)
                          throws java.sql.SQLException
        Retrieves the ID of a component type by its name.
        Parameters:
        nombre - The name of the component type to search for
        Returns:
        The ID of the component type if found, -1 if not found
        Throws:
        java.sql.SQLException - if a database error occurs during the query