I have the following entities:
@Entity
@Table(name = "Work_Order")
public class WorkOrder {
@Id
@GeneratedValue
private long id;
@ManyToOne
@JoinColumn(name = "transaction_group_id")
private TransactionGroup transactionGroup;
}
@Entity
@Table(name = "Transaction_Group")
public class TransactionGroup {
@Id
@GeneratedValue
private long id;
@TenantId
@Column(name = "tenant_id", nullable = false)
private String tenantId;
@Column(name = "timestamp", nullable = false)
private long timestamp;
@ManyToOne
public long getId() {
return id;
}
public String getTenantId() {
return tenantId;
}
public long getTimestamp() {
return timestamp;
}
}
Why JPA Buddy gives me the following error when i try to generate a db snapshot?
I have an ID in the TransactionGroup entity.
Also, i have tried to use Long instead of long for the ID. However, it didn’t give any results.
CodePudding user response:
All you need to do – is to remove the @ManyToOne annotation from your getId() method.
By the way, I've just checked that Hibernate doesn't complain about such annotations over methods, so we'll try to do the same in the next JPA Buddy releases. Here you can track the status of this task: https://issues.jpa-buddy.com/issue/JPAB-2246.