I m getting a weird error while I m debugging my POC. I have 2 entities:
@Getter
@Setter
@Entity
@Table(name = "APPLICANT")
public class Applicant implements Serializable {
private static final long serialVersionUID = 6060170457948717553L;
@Id
@Column(name = "applicant_id", insertable = false, nullable = false)
private Long applicantId;
@Column(name = "application_id", unique = true)
private String applicationId;
@OneToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "application_id", referencedColumnName = "application_id", insertable =
false, updatable = false)
private ApplicationEntity applicationEntity;
@Getter
@Setter
@Entity
@Table(name = "APPLICATION")
public class ApplicationEntity implements Serializable{
private static final long serialVersionUID = 7300036359295729197L;
@Id
@Column(name = "APPLICATION_ID")
private String id;
@OneToOne(mappedBy = "applicationEntity", fetch = FetchType.LAZY)
private Applicant applicant;
These classes has the repositories interfaces extending from CrudRepository, and in the Applicant
repository I have a custom method to get the entity with the applicationId:
Applicant findByApplicationId(String applicationId);
But, when I m debugging, I see the following message in the intellij debuguer on the applicationEntity
attribute:
Method threw org.hibernate. LazyInitializationException exception. Cannot evaluation org.example.postgres.jpa.model.ApplicationEntity$HibernateProxy$qa4PKx8V.toString(
数值qa4PKx8V
每次我进行新的测试时都会发生变化。
我在<代码>@中尝试了许多组合。 Join annotation, I ve/2008/2 the lombook note, I ve used the @ Transactional
annotation both, but ishas the same wrong.
A key point to note, is that I can get the data from the table with any error, I just see this message in the debugger, so my question is, this is a thing of intellij or something like that? Or I need to fix this with configuration or changing something in my code?
Thanks.