[jboss-user] [EJB 3.0] - Re: problems with @Idclass

jaikiran do-not-reply at jboss.com
Wed Apr 16 05:56:52 EDT 2008


"lastra" wrote : 
  | 
  | 
  | it say, the name of the field "numeroLinea" not is correct, but i dont understand coz is the same field as my datebase table.
  | 
  | 

I dont think you have a column named "numeroLinea" in your table. I guess, you have a column named NUMERO_LINEA. Looking back at the code that you posted, i guess you will have to move the @Column annotations to the PK class. Something like this:

Entity class (remove the @Column annotation from this class for the Ids):
@Entity
  | @Table(name="APUNTES")
  | @IdClass(ApuntesPK.class)
  | public class Apuntes implements Serializable{
  | 	//Claves
  | 	@Id
  | 	private Integer empresa;
  | 
  | 	@Id
  | 	private Integer numeroAsiento;
  | 
  | 	@Id
  | 	private Integer numeroLinea;
  | 
  | 	private String modificado;
  | 	.......
  | 	others fields and methods get/set
  | 
  | }

The PK class (introduce the @Column annotation on the id columns):

  | public class ApuntesPK implements Serializable {
  | 
  | 	@Column(name="EMPRESA")
  | 	private Integer empresa;
  | 
  | 	@Column(name="NUMERO_ASIENTO")
  | 	private Integer numeroLinea;
  | 
  | 	@Column(name="NUMERO_LINEA")
  | 	private Integer numeroAsiento;
  | 
  | 	//private static final long serialVersionUID = 1L;
  | 
  | 	public ApuntesPK() {
  | 
  | }


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144427



More information about the jboss-user mailing list