Detail: Key columns "document_number" and "document_number" are of incompatible types: character var

I've created class Invoice and class Invoice line that is a part of the invoice. Id in Invoice looks like this:
@Id
@Column(name = "documentNumber", length = 14)
private String documentNumber;
@Id
@Column(name = "documentNumber", length = 14)
private String documentNumber;
and the invoice line relationship looks like this:
@OneToMany(mappedBy = "invoice", cascade = CascadeType.ALL, orphanRemoval = true)
private List<InvoiceLine> invoiceLineList;
@OneToMany(mappedBy = "invoice", cascade = CascadeType.ALL, orphanRemoval = true)
private List<InvoiceLine> invoiceLineList;
For Invoice line I have this:
@ManyToOne
@JoinColumn(name = "documentNumber", referencedColumnName = "documentNumber", nullable = false)
private Invoice invoice;
@ManyToOne
@JoinColumn(name = "documentNumber", referencedColumnName = "documentNumber", nullable = false)
private Invoice invoice;
In my code they are both varchar, could the error be caused by PostgreSQL?
1 Reply
JavaBot
JavaBot7mo ago
This post has been reserved for your question.
Hey @the goat! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server