Package com.signalapp.dao
Class TiposComponenteDAO
- java.lang.Object
-
- com.signalapp.dao.BaseDAO<TipoComponente>
-
- com.signalapp.dao.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).
-
-
Field Summary
-
Fields inherited from class com.signalapp.dao.BaseDAO
connection
-
-
Constructor Summary
Constructors Constructor Description TiposComponenteDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String[]getColumnNames()Returns the column names for the TiposComponente table.intgetIdByNombre(java.lang.String nombre)Retrieves the ID of a component type by its name.protected java.lang.StringgetTableName()Returns the name of the database table for component types.protected TipoComponentemapResultSetToEntity(java.sql.ResultSet rs)Maps a database result set row to a TipoComponente entity.protected voidsetPreparedStatementParams(java.sql.PreparedStatement ps, TipoComponente entity)Sets the parameters for database operations using a TipoComponente entity.
-
-
-
Method Detail
-
getTableName
protected java.lang.String getTableName()
Returns the name of the database table for component types.- Specified by:
getTableNamein classBaseDAO<TipoComponente>- Returns:
- The table name "tipos_componente"
-
getColumnNames
protected java.lang.String[] getColumnNames()
Returns the column names for the TiposComponente table.- Specified by:
getColumnNamesin classBaseDAO<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:
mapResultSetToEntityin classBaseDAO<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.SQLExceptionSets the parameters for database operations using a TipoComponente entity.- Specified by:
setPreparedStatementParamsin classBaseDAO<TipoComponente>- Parameters:
ps- The PreparedStatement to set parameters forentity- 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.SQLExceptionRetrieves 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
-
-