Open Scarpah600 opened 5 years ago
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>Projeto</groupId>
<artifactId>Projeto</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>prime-repo</id>
<name>Prime Repo</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
package br.com.Jc1.DAO;
import java.sql.Connection; import java.sql.SQLException;
import java.sql.PreparedStatement;
import br.com.Jc1.domain.Filmes; import br.com.Jc1.factory.ConexaoFactory;
public class FilmesDao {
public void salvar(Filmes f) throws SQLException {
StringBuilder sql = new StringBuilder();
sql.append("INSERT INTO db_filmes");
sql.append("(NOME_FILMES)");
sql.append("(CATEGORIA_FILMES)");
sql.append("(DATA_FILMES)");
sql.append("(DESCRICAO_FILMES)");
sql.append("VALUES(?,?,?,?)");
Connection conexao = ConexaoFactory.conectar();
PreparedStatement comando = conexao.prepareStatement(sql.toString());
comando.setString(1, f.getFilmes());
comando.setString(2, f.getGenero_f());
comando.setString(3, f.getDatfilmes());
comando.setString(4, f.getDescri());
comando.executeUpdate();
}
public void deletar(Filmes f) throws SQLException {
StringBuilder sql = new StringBuilder();
sql.append("DELETE FROM db_filmes");
sql.append("WHERE ID = ?");
Connection conexao = ConexaoFactory.conectar();
PreparedStatement comando = conexao.prepareStatement(sql.toString());
comando.setLong(1, f.getId());
comando.executeUpdate();
}
public void consultarNome(Filmes f) throws SQLException
{
StringBuilder sql = new StringBuilder();
sql.append("SELECT NOME_FILMES");
sql.append("FROM db_filmes");
}
public void editar(Filmes f) throws SQLException {
StringBuilder sql = new StringBuilder();
sql.append("UPDATE db_filmes");
sql.append("SET NOME_FILMES = ? ");
sql.append("GENERO_FILMES = ? ");
sql.append("DATA_FILMES = ?");
sql.append("DESCRICAO_FILMES = ?");
sql.append("WHERE ID = ?");
Connection conexao = ConexaoFactory.conectar();
PreparedStatement comando = conexao.prepareStatement(sql.toString());
comando.setLong(1, f.getId());
comando.setString(2, f.getFilmes());
comando.setString(3, f.getGenero_f());
comando.setString(4, f.getDatfilmes());
comando.setString(5, f.getDescri());
comando.executeUpdate();
}
public static void main(String[] args) {
}
}
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">