I want to use a bean arraylist into the another bean as a field. And I got "mappedBy reference an unknown target entity property" error.
I have two class 1. Logs 2. Log and all Logs element includes one more than a Log. log.executionid can be multiple records, but all logs.executionid must be different
@Entity
@Table(name = "t_logs")
public class Logs {
@Id
@Column(name = "executionid")
private String executionId;
@Column(name = "sentdate")
@Temporal(TemporalType.TIMESTAMP)
private Date sendDate;
@Column(name = "exceptionmessage")
private String exceptionMessage;
@OneToMany(mappedBy = "executionid", cascade = CascadeType.ALL)
private List<Log> loglist;
}
@Entity
@Table(name = "t_log")
public class Log {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private long id;
@Column(name = "executionid")
private String executionId;
@Column(name = "startdate")
@Temporal(TemporalType.TIMESTAMP)
private Date startDate;
@Column(name = "enddate")
@Temporal(TemporalType.TIMESTAMP)
private Date endDate;
}
here is correct answer thanks to @Guilherme Ribeiro Developer
Logs table;
@OneToMany(mappedBy = "logs", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<Log> loglist;
Log table;
@ManyToOne
@JoinColumn(name = "executionid")
private Logs logs;