Skip to content

Instantly share code, notes, and snippets.

@thjanssen
Last active June 17, 2016 04:10
Show Gist options
  • Save thjanssen/b0c4a0ea387e5efc73f5be3cce1ed015 to your computer and use it in GitHub Desktop.
Save thjanssen/b0c4a0ea387e5efc73f5be3cce1ed015 to your computer and use it in GitHub Desktop.
@Entity
@Immutable
public class BookView {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
@Version
@Column(name = "version")
private int version;
@Column
private String title;
@Column
@Temporal(TemporalType.DATE)
private Date publishingDate;
@Column
private String authors;
...
}
List<BookView> bvs = em.createQuery("SELECT v FROM BookView v", BookView.class).getResultList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment