Skip to content

Instantly share code, notes, and snippets.

jhoryna / gist:d59157ef74c3eaa2056f
Created February 22, 2015 11:43
Database view with no notion of primary key as @entity using EclipseLink 2.5.x, JPA 2.0
Hi Adam,
We read data from a database view. This view has no database-side notion of primary key, but the columns (MyView.a, MyView.b, MyView.c) uniquelly identify a record. The columns MyView.a and MyView.b can contain NULL values.
My Java entity class looks like this:
@PrimaryKey(validation=IdValidation.NONE, columns={@column(name="a"), @column(name="b", @column(name="c")})
public class MyView implements Serializable ......
If I run the query (as JUnit test) then I will receive the following error message: