Composite primary key
jorge_tello5 Aug 2, 2005 5:39 PMHi All,
My problem is:
I got an Entity RolProcTrans (pk is codProceso, codTrans,tipoRol).
@Entity
@Table(name = "ROL_PROC_TRANS")
public class RolProcTrans implements Serializable {
private RolProcTransPK pk;
private RolTransaccion1 rolTransaccion1;
@ManyToOne
@JoinColumns( {
@JoinColumn(name = "COD_TRANS", insertable = false, updatable = false),
@JoinColumn(name = "TIPO_ROL", insertable = false, updatable = false) })
public RolTransaccion1 getRolTransaccion1() {
return rolTransaccion1;
}
public void setRolTransaccion1(RolTransaccion1 rolTransaccion1) {
this.rolTransaccion1 = rolTransaccion1;
}
@Id(generate=GeneratorType.NONE)
public RolProcTransPK getPk() {
return pk;
}
public void setPk(RolProcTransPK pk) {
this.pk = pk;
}
}the pk class is:
@Embeddable
public class RolProcTransPK implements Serializable {
private Long codProceso;
private String codTrans;
private Integer tipoRol;
...and Entity RolTransaccion1
@Entity
@Table(name = "ROL_TRANSACCION_1")
public class RolTransaccion1 implements Serializable {
private String codEmpresa;
private RolTransaccion1PK pk;
private List<RolProcTrans> rolesProcTrans;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "rolTransaccion1")
public List<RolProcTrans> getRolesProcTrans() {
return rolesProcTrans;
}
public void setRolesProcTrans(List<RolProcTrans> rolesProcTrans) {
this.rolesProcTrans = rolesProcTrans;
}
@Column(name = "COD_EMPRESA")
public String getCodEmpresa() {
return codEmpresa;
}
public void setCodEmpresa(String codEmpresa) {
this.codEmpresa = codEmpresa;
}
@Id(generate=GeneratorType.NONE)
public RolTransaccion1PK getPk() {
return pk;
}
public void setPk(RolTransaccion1PK pk) {
this.pk = pk;
}
}pk class
@Embeddable
public class RolTransaccion1PK implements Serializable {
private String codTrans;
private Integer tipoRol;
...I´m use SQL Server 2000 SP3.
When I try list RolProcTrans Entity
the error is:
16:13:38,623 ERROR [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.
I try, remove @ManyToOne relation and this function correctly
What Happend?
pleace some Idea.
Thank you very much