alexspaola
Newbie

Mensajes: 1
|
 |
« en: Junio 29, 2008, 01:29:30 » |
|
hola, necesito ayuda estoy haciendo una aplicacion en java con hibernate y spring. Aquie he desarrollado mis clases de persistencia, mis interfaces services y mis clases.services.impl
esta es mi clase de persistencia
package com.constructora.persistence; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.Table;
@SuppressWarnings("serial") @Entity @Table(name = "CLIENTE") public class Cliente implements java.io.Serializable { private int idCliente; private String cedula; private String nombres; private String apellidos; private String telefono; private String direccion; private String email; public Cliente(){};
@Column(name = "APELLIDOS", nullable = false, length = 30) public String getApellidos() { return apellidos; } public void setApellidos(String apellidos) { this.apellidos = apellidos; }
@Column(name = "CIDENTIDAD", nullable = false, length = 30) public String getCedula() { return cedula; } public void setCedula(String cedula) { this.cedula = cedula; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "NUM_CLIENTE", unique = true, nullable = false) public int getIdCliente() { return idCliente; }
public void setIdCliente(int idCliente) { this.idCliente = idCliente; };
@Column(name = "DIRECCION", nullable =true , length = 30) public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; }
@Column(name = "EMAIL", nullable = false, length = 60) public String getEmail() { return email; } public void setEmail(String email) { this.email = email; }
@Column(name = "NOMBRES", nullable = false, length = 30) public String getNombres() { return nombres; } public void setNombres(String nombres) { this.nombres = nombres; }
@Column(name = "TELEFONO", nullable = true, length = 10) public String getTelefono() { return telefono; } public void setTelefono(String telefono) { this.telefono = telefono; }
}
estas son mis interfaces
public interface ClienteServices {
public int crearCliente(Cliente cliente); public Cliente buscarClientePorCedula(String cedula); public void modificarCliente (Cliente cliente); }
y en el paquete services.impl
@Transactional(propagation = Propagation.REQUIRED) public class ClienteServicesImpl implements ClienteServices {
/* (non-Javadoc) * @see com.constructora.services.ClienteServices#buscarClientePorCedula(java.lang.String) */ private static final Logger logger = Logger.getLogger(ClienteServicesImpl.class);
@PersistenceContext(unitName = "construccion") private EntityManager em;
/* (non-Javadoc) * @see com.constructora.services.ClienteServices#crearCliente(com.constructora.persistence.Cliente) */ public int crearCliente(Cliente cliente) { // TODO Auto-generated method stub em.persist(cliente); logger.info("El cliente se ha registrado satisfactoriamente"); return cliente.getidCliente; } catch(Exception e){ logger.error("Error al crear el cliente:",e); return 1; } }
El problema es el siquiente
necesito un backing bean para poder insertar los datos en la base de datos
S.O.S es de unrgencia voy a perder el semestre auxiliooooooooooooooooooooooooooooooooo
|