Package com.signalapp.dao
Class ComponenteDAO
- java.lang.Object
-
- com.signalapp.dao.BaseDAO<Componente>
-
- com.signalapp.dao.ComponenteDAO
-
public class ComponenteDAO extends BaseDAO<Componente>
Data Access Object for the Componentes table Handles database operations for component entities
-
-
Field Summary
-
Fields inherited from class com.signalapp.dao.BaseDAO
connection
-
-
Constructor Summary
Constructors Constructor Description ComponenteDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexistsByModelo(java.lang.String modelo)Checks if a component with the given model name already existsComponentefindByModelo(java.lang.String modelo)Finds a component by its model nameprotected java.lang.String[]getColumnNames()Gets the column names for the Componentes tableintgetIdByModelo(java.lang.String modelo)Retrieves the ID of a component by its model nameprotected java.lang.StringgetTableName()Gets the name of the database tableprotected ComponentemapResultSetToEntity(java.sql.ResultSet rs)Maps a ResultSet row to a Componente entityprotected voidsetPreparedStatementParams(java.sql.PreparedStatement ps, Componente entity)Sets the parameters for a PreparedStatement based on Componente properties
-
-
-
Method Detail
-
getTableName
protected java.lang.String getTableName()
Gets the name of the database table- Specified by:
getTableNamein classBaseDAO<Componente>- Returns:
- The table name "componentes"
-
getColumnNames
protected java.lang.String[] getColumnNames()
Gets the column names for the Componentes table- Specified by:
getColumnNamesin classBaseDAO<Componente>- Returns:
- Array of column names
-
mapResultSetToEntity
protected Componente mapResultSetToEntity(java.sql.ResultSet rs) throws java.sql.SQLException
Maps a ResultSet row to a Componente entity- Specified by:
mapResultSetToEntityin classBaseDAO<Componente>- Parameters:
rs- The ResultSet containing the database row- Returns:
- A new Componente object with data from the ResultSet
- Throws:
java.sql.SQLException- if a database error occurs
-
setPreparedStatementParams
protected void setPreparedStatementParams(java.sql.PreparedStatement ps, Componente entity) throws java.sql.SQLExceptionSets the parameters for a PreparedStatement based on Componente properties- Specified by:
setPreparedStatementParamsin classBaseDAO<Componente>- Parameters:
ps- The PreparedStatement to set parameters forentity- The Componente entity containing the values to set- Throws:
java.sql.SQLException- if a database error occurs
-
getIdByModelo
public int getIdByModelo(java.lang.String modelo) throws java.sql.SQLExceptionRetrieves the ID of a component by its model name- Parameters:
modelo- The model name of the component- Returns:
- The ID of the component, or -1 if not found
- Throws:
java.sql.SQLException- if a database error occurs
-
findByModelo
public Componente findByModelo(java.lang.String modelo) throws java.sql.SQLException
Finds a component by its model name- Parameters:
modelo- The model name to search for- Returns:
- The Componente object if found, null otherwise
- Throws:
java.sql.SQLException- if a database error occurs
-
existsByModelo
public boolean existsByModelo(java.lang.String modelo) throws java.sql.SQLExceptionChecks if a component with the given model name already exists- Parameters:
modelo- The model name of the component to check- Returns:
- true if a component with the model name exists, false otherwise
- Throws:
java.sql.SQLException- if a database error occurs
-
-