Licitatie Entity:
@Entity
@Table(name="licitatie")
public class Licitatie implements Serializable {
...
//bi-directional one-to-one association to Licitatie
@OneToOne(mappedBy="licitatie")
private Produs produs;
...
}
Produs Entity:
@Entity
@Table(name="produs")
//@DiscriminatorColumn(name="id", discriminatorType=DiscriminatorType.INTEGER)
@MappedSuperclass
public class Produs implements Serializable {
...
//bi-directional one-to-one association to Produs
@OneToOne
@JoinColumn(name="licitatie_id")
private Licitatie licitatie;
...
}
Database:
Licitatie:
id start status
1 5 open
2 5 open
3 5 open
Produs:
id licitatie_id DTYPE description
1 1 Carte ...
2 2 Carte ...
3 3 Carte ...
After I run tris query: "SELECT t FROM Licitatie t" , the attribute Product from object of type Licitatie is null. But there are records in tables.
What I'm doing wrong?
* EDIT *
After I get data from table, calling getProdus() return this message:
{IndirectSet: not instantiated}
SOLVED
I've added column PRODUS_ID to licitatie table.
Licitatie: id produs_id ... Produs: id, licitatie_id ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.