Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ventas.conexion.tablas;
- import java.sql.CallableStatement;
- import java.sql.Connection;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import ventas.conexion.Conexion;
- public class ventasBodegasProductos {
- Connection connMY = null;
- private String host,bd,user,pass;
- private int idVentaBodegaProducto;
- private int cantidad;
- private int idVenta;
- private int idBodegaProducto;
- public ventasBodegasProductos (String host, String bd, String user, String pass) {
- this.host = host; this.bd = bd; this.user = user; this.pass = pass;
- }
- /**
- * Devuelve el id del resultado del query de la tabla bodegaProducto
- * @return
- */
- public int getIdVentaBodegaProducto() {
- return this.idVentaBodegaProducto;
- }
- public int getCantidad () {
- return this.cantidad;
- }
- public int getIdVenta () {
- return this.idVenta;
- }
- public int getIdBodegaProducto () {
- return this.idBodegaProducto;
- }
- public void setIdVentaBodegaProducto (int vbp) {
- this.idVentaBodegaProducto = vbp;
- }
- public void setCantidad (int c) {
- this.cantidad = c;
- }
- public void setIdVenta (int iv) {
- this.idVenta = iv;
- }
- public void setIdBodegaProducto (int ibp) {
- this.idBodegaProducto = ibp;
- }
- @SuppressWarnings("static-access")
- public final synchronized void selectAllByID (int id) throws ClassNotFoundException, SQLException {
- Conexion c = new Conexion();
- connMY = c.Conectar(host,bd,user,pass);
- CallableStatement pa = connMY.prepareCall("{ call selectAllByID_ventasBodegasProductos(?) }");
- pa.setInt("ID", id);
- ResultSet rs = pa.executeQuery();
- rs.first();
- this.setIdVentaBodegaProducto(rs.getInt("idVentaBodegaProducto"));
- this.setCantidad(rs.getInt("cantidad"));
- this.setIdVenta(rs.getInt("idVenta"));
- this.setIdBodegaProducto(rs.getInt("idBodegaProducto"));
- connMY.close();
- }
- }
Add Comment
Please, Sign In to add comment