Null value if read the same @ManyToOne Entity [message #1062374] |
Fri, 07 June 2013 08:46  |
Eclipse User |
|
|
|
Hi,
i use EclipseLink 2.4, JPA 2.0 and Spring framework.
I have the following entity:
@Entity
@Table(name="DIPENDENTE")
public class Dipendente implements Serializable {
@Id
@Column(name="C_DIPENDENTE")
private String cDipendente;
@Column(name="NOME")
private String nome;
@Column(name="COGNOME")
private String cognome;
@ManyToOne
@JoinColumn(name="RECAPITO")
private Recapito recapito;
.......
}
@Entity
@Table(name="RECAPITO")
public class Recapito implements Serializable {
@Id
@Column(name="C_RECAPITO")
private String cRecapito;
@Column(name="VIA")
private String via;
@Column(name="LANG")
private String lang;
.......
}
after Dipendente entity persist i have the following situation in db:
C_DIPENDENTE NOME COGNOME RECAPITO
12345 Mario Rossi 1
67890 Luca Verdi 1
C_RECAPITO VIA LANG
1 Via Manzoni IT
But when i read all data with the following JPQL query:
query.append("SELECT d FROM Dipendente d ");
query.append("JOIN FETCH d.recapito r ");
query.append("WHERE ");
query.append("d.lang = 'IT' ");
the field VIA of Recapito entity is set to null value. I don't know why.
Any ideas?
Thanks
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04511 seconds