Hello, I'm using Jboss 4.0.4 installed with EJB. and I'm having a problem with 
the EntityManager.

It seems that it does not initialize the Entitys when I try to get an object 
from the DB with the find method.

This is my test unit code:


  |     public void testIngresarPrestacion(){
  |             TipoPractica tp = (TipoPractica) 
controladorEjb.cargar(TipoPractica.class,new Integer(1));
  |             System.out.println("tipoPractica.descripcion = " + 
tp.getDescripcion());
  |     }
  | 

controladorEjb: an stateless session bean access remotely through JNDI
controladorEjb.cargar: exactly the same than EntityManager.find()

When I debug it, controladorEjb.cargar() return an instance of TipoPractica but 
with no property set.

In the log file I get:
anonymous wrote : 
  | 2006-09-12 11:58:10,359 DEBUG [org.hibernate.pretty.Printer] listing 
entities:
  | 2006-09-12 11:58:10,359 DEBUG [org.hibernate.pretty.Printer] 
ar.com.selenca.TipoPractica{valorBase=10.0, titulo=10905, descripcion=Lifemia o 
lipidos totales en sangre, nomenclado=true, id=1, activo=true, fechaAlta=null, 
usuarioAlta=null, especialidad=null, capitulo=10904, usuarioModificacion=null, 
fechaModificacion=null, codigo=8614}
  | 

when the query is executed, so it gets all the information from the DB but for 
some reason it does not complete the bean properly.

I have isolate the problem in a mini Java proyect, feel free to ask me for it.

Here is the TipoPractica java file:

  | package ar.com.selenca;
  | 
  | import java.io.Serializable;
  | 
  | import javax.persistence.DiscriminatorValue;
  | import javax.persistence.Entity;
  | 
  | 
  | @Entity
  | @DiscriminatorValue("TP")
  | public class TipoPractica extends TipoPrestacion implements Serializable
  | {
  |     private static final long serialVersionUID = 3688507705476263988L;
  | 
  | 
  | }
  | 

and TipoPrestacion : 


  | package ar.com.selenca;
  | 
  | import java.util.Date;
  | 
  | import javax.persistence.Column;
  | import javax.persistence.DiscriminatorColumn;
  | import javax.persistence.DiscriminatorType;
  | import javax.persistence.DiscriminatorValue;
  | import javax.persistence.Entity;
  | import javax.persistence.GeneratedValue;
  | import javax.persistence.Id;
  | import javax.persistence.Inheritance;
  | import javax.persistence.InheritanceType;
  | import javax.persistence.Table;
  | import javax.persistence.Transient;
  | 
  | @Entity
  | @Table(name="PRESTACION_TIPO")
  | @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  | 
@DiscriminatorColumn(name="PRT_TIPO",discriminatorType=DiscriminatorType.STRING)
  | @DiscriminatorValue("XX")
  | public abstract class TipoPrestacion 
  | {
  |     private Integer id;
  |     private String codigo;
  |     private String descripcion;
  |     
  |     private double valorBase;
  |     private String especialidad;
  |     private Integer capitulo;
  |     private Integer titulo;
  |     
  |     private boolean nomenclado = true;
  |     
  |     private Date fechaAlta;
  |     private String usuarioAlta;
  |     private Date fechaModificacion;
  |     private String usuarioModificacion;
  |     
  |     private boolean activo = true;
  |     
  |     @Column(name="PRT_CODIGO",nullable=false)
  |     public String getCodigo()
  |     {
  |         return this.codigo;
  |     }
  |     public void setCodigo(String codigo)
  |     {
  |         this.codigo = codigo;
  |     }
  | 
  |     @Column(name="PRT_DESCRIPCION")
  |     public String getDescripcion()
  |     {
  |         return this.descripcion;
  |     }
  |     public void setDescripcion(String descripcion)
  |     {
  |         this.descripcion = descripcion;
  |     }
  | 
  |     @Id
  |     @GeneratedValue
  |     @Column(name="PRT_ID")
  |     public Integer getId()
  |     {
  |         return this.id;
  |     }
  |     public void setId(Integer id)
  |     {
  |         this.id = id;
  |     }
  |     
  |     @Column(name="PRT_ACTIVO")
  |     public boolean getActivo()
  |     {
  |             return activo;
  |     }
  |     public void setActivo(boolean activo)
  |     {
  |             this.activo = activo;
  |     }
  |     
  |     @Column(name="PRT_FECHA_ALTA")
  |     public Date getFechaAlta() 
  |     {
  |             return fechaAlta;
  |     }
  |     public void setFechaAlta(Date fechaAlta) 
  |     {
  |             this.fechaAlta = fechaAlta;
  |     }
  | 
  |     @Column(name="PRT_FECHA_MODIFICACION")
  |     public Date getFechaModificacion() 
  |     {
  |             return fechaModificacion;
  |     }
  |     public void setFechaModificacion(Date fechaModificacion) 
  |     {
  |             this.fechaModificacion = fechaModificacion;
  |     }
  | 
  |     @Column(name="PRT_USUARIO_ALTA")
  |     public String getUsuarioAlta()
  |     {
  |             return usuarioAlta;
  |     }
  |     public void setUsuarioAlta(String usuarioAlta) 
  |     {
  |             this.usuarioAlta = usuarioAlta;
  |     }
  | 
  |     @Column(name="PRT_USUARIO_MODIFICACION")
  |     public String getUsuarioModificacion() 
  |     {
  |             return usuarioModificacion;
  |     }
  |     public void setUsuarioModificacion(String usuarioModificacion) 
  |     {
  |             this.usuarioModificacion = usuarioModificacion;
  |     }
  |     
  |     @Column(name="PRT_ESPECIALIDAD")
  |     public String getEspecialidad()
  |     {
  |         return this.especialidad;
  |     }
  |     public void setEspecialidad(String especialidad)
  |     {
  |         this.especialidad = especialidad;
  |     }
  | 
  |     @Column(name="PRT_IDCAPITULO")
  |     public Integer getCapitulo()
  |     {
  |         return this.capitulo;
  |     }
  |     public void setCapitulo(Integer capitulo)
  |     {
  |         this.capitulo = capitulo;
  |     }
  | 
  |     @Column(name="PRT_IDTITULO")
  |     public Integer getTitulo()
  |     {
  |         return this.titulo;
  |     }
  |     public void setTitulo(Integer titulo)
  |     {
  |         this.titulo = titulo;
  |     }
  |     
  |     @Column(name="PRT_NOMENCLADO")
  |     public boolean isNomenclado()
  |     {
  |         return this.nomenclado;
  |     }
  |     public void setNomenclado(boolean nomenclado)
  |     {
  |         this.nomenclado = nomenclado;
  |     }
  | 
  |     @Column(name="PRT_VALOR_BASE")
  |     public double getValorBase()
  |     {
  |             return valorBase;
  |     }
  |     public void setValorBase(double valorBase)
  |     {
  |             this.valorBase = valorBase;
  |     }
  |     
  |     @Transient
  |     public String getIdentidad()
  |     {
  |             return this.descripcion + " [" + this.codigo + "] ";
  |     }
  | }
  | 

Thanks in advance.

----
Sebastian Javier Marchano
www.selenca.com

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971084#3971084

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971084
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to