Victor
Victor

Reputation: 17077

JPA JoinColumn Annotation

In my JPA class, I have this Annotation and the syntax I am not able to understand

@JoinColumns({
    @JoinColumn(name="RES_ID", referencedColumnName="ACCT_ID"),
    @JoinColumn(name="DELETED", referencedColumnName="'N'")
})
protected Account account;

The first line is ok: The current class has column in db (RES_ID) which joins with Account which has a column ACCT_ID

But the second line says :

@JoinColumn(name="DELETED", referencedColumnName="'N'")

Now both these tables have a column called DELETED. Is that a shorthand way of saying that join the two tables when both these tables have DELETED = 'N'?

Because the documentation says that referencedColumn should contain a columnName. here it is containing a value = N

Upvotes: 2

Views: 2020

Answers (1)

Heri
Heri

Reputation: 2124

Let me guess, you're using OpenJPA? This is surely not a specified JPA feature, but OpenJPA has such a feature called constant joins in its Non-Standard Joins.

Upvotes: 1

Related Questions