I have 2 bean classes(ticketEntity
, ticketCircuitInfo
) mapped to 1 table each
I also have 1 ticketEntity(primary key)
that can have multiple ticketCircuitInfo(forign key)
The ticketEntity
bean has the following properties:
@Id
@Column(name = "ticket_id", unique = true, nullable = false)
private String ticketId;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "ticket", cascade =CascadeType.ALL)
private Set<TicketCircuitInfo> ticketCircuitInfo;
The ticketCircuitInfo bean has the following properties:
@GenericGenerator(name = "generator", strategy = "foreign",
parameters = @Parameter(name = "property", value = "ticket"))
@Id
@Column(name = "ticket_id", unique = true, nullable = false)
private String ticketId;
@ManyToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private TicketEntity ticket;`
I'm getting:
com.sun.jdi.InvocationException occurred invoking method.
While debugging on the line ticket.ticketCircuitInfo()
.
further exception being printed is:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:ticketCircuitInfo, could not initialize proxy - no Session