Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/05/2013, 04:16
carsoma
 
Fecha de Ingreso: mayo-2012
Mensajes: 26
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Error usando persist() en Hibernate

Gracias por la respuesta pero eso no lo soluciona.


He probado:
Código PHP:
User user = new User();    

System.out.println(requ.getParameter("email"));
System.out.println(requ.getParameter("nombre"));
System.out.println(requ.getParameter("apellidos"));
            
user.setFirstName(requ.getParameter("nombre"));
user.setLastName(requ.getParameter("apellidos"));
user.setEmailAddress(requ.getParameter("email"));
            
user.setPassword("poruesadf");
            
System.out.println("User:"+user);
user.persist(); 
Y he obtenido:
Cita:
[email protected]
myfirstname
mylastname
set firstname
User, nombre:User[firstName=<null>,lastName=<null>,emailAddress=<nul l>,password=<null>,activationDate=<null>,activatio nKey=<null>,enabled=<null>,locked=<null>,id=<null> ,version=<null>,clientes=<null>,incidencias=<null> ,userRoles=<null>,empresaId=<null>]
No sé porque todos los parámetros de user están a null


Aquí está mi User_Roo_DbManaged.aj:
Código PHP:
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).

package com.springsource.marshall.domain;

import com.springsource.marshall.domain.Cliente;
import com.springsource.marshall.domain.Empresa;
import com.springsource.marshall.domain.Incidencia;
import com.springsource.marshall.domain.User;
import com.springsource.marshall.domain.UserRole;
import java.util.Date;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;

privileged aspect User_Roo_DbManaged {
    
    @
OneToMany(mappedBy = "userId")
    private 
Set<Cliente> User.clientes;
    
    @
OneToMany(mappedBy = "userId")
    private 
Set<Incidencia> User.incidencias;
    
    @
OneToMany(mappedBy = "userEntry")
    private 
Set<UserRole> User.userRoles;
    
    @
ManyToOne
    
@JoinColumn(name = "empresa_id", referencedColumnName = "id")
    private 
Empresa User.empresaId;
    
    @
Column(name = "firstName", length = 99, insertable=false,updatable=false)
    private 
String User.firstName;
    
    @
Column(name = "lastName", length = 30, insertable=false,updatable=false)
    private 
String User.lastName;
    
    @
Column(name = "password", length = 100, insertable=false,updatable=false)
    private 
String User.password;
    
    @
Column(name = "emailAddress", length = 45, insertable=false,updatable=false)
    private 
String User.emailAddress;
    
    
    @
Column(name = "activationDate", insertable=false,updatable=false)
    @
Temporal(TemporalType.DATE)
    @
DateTimeFormat(style = "M-")
    private 
Date User.activationDate;
    
    @
Column(name = "activationKey", length = 45, insertable=false,updatable=false)
    private 
String User.activationKey;
    
    @
Column(name = "enabled", insertable=false,updatable=false)
    private 
Boolean User.enabled;
    
    @
Column(name = "locked", insertable=false,updatable=false)
    private 
Boolean User.locked;
    
    public 
Set<Cliente> User.getClientes() {
        return 
clientes;
    }
    
    public 
void User.setClientes(Set<Cliente> clientes) {
        
this.clientes = clientes;
    }
    
    public 
Set<Incidencia> User.getIncidencias() {
        return 
incidencias;
    }
    
    public 
void User.setIncidencias(Set<Incidencia> incidencias) {
        
this.incidencias = incidencias;
    }
    
    public 
Set<UserRole> User.getUserRoles() {
        return 
userRoles;
    }
    
    public 
void User.setUserRoles(Set<UserRole> userRoles) {
        
this.userRoles = userRoles;
    }
    
    public 
Empresa User.getEmpresaId() {
        return 
empresaId;
    }
    
    public 
void User.setEmpresaId(Empresa empresaId) {
        
this.empresaId = empresaId;
    }
    
    public 
String User.getFirstName() {
        return 
firstName;
    }
    
    public 
void User.setFirstName(String firstName) {
        
this.firstName = firstName;
    }
    
    public 
String User.getLastName() {
        return 
lastName;
    }
    
    public 
void User.setLastName(String lastName) {
        
this.lastName = lastName;
    }
    
    public 
String User.getPassword() {
        return 
password;
    }
    
    public 
void User.setPassword(String password) {
        
this.password = password;
    }
    
    public 
String User.getEmailAddress() {
        return 
emailAddress;
    }
    
    public 
void User.setEmailAddress(String emailAddress) {
        
this.emailAddress = emailAddress;
    }
    
    public 
Date User.getActivationDate() {
        return 
activationDate;
    }
    
    public 
void User.setActivationDate(Date activationDate) {
        
this.activationDate = activationDate;
    }
    
    public 
String User.getActivationKey() {
        return 
activationKey;
    }
    
    public 
void User.setActivationKey(String activationKey) {
        
this.activationKey = activationKey;
    }
    
    public 
Boolean User.getEnabled() {
        return 
enabled;
    }
    
    public 
void User.setEnabled(Boolean enabled) {
        
this.enabled = enabled;
    }
    
    public 
Boolean User.getLocked() {
        return 
locked;
    }
    
    public 
void User.setLocked(Boolean locked) {
        
this.locked = locked;
    }
    
}