This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuditQuery q = auditReader.createQuery().forEntitiesAtRevision(Book.class, 2); | |
q.traverseRelation(“publisher”, JoinType.LEFT, “p”); | |
q.add(AuditEntity.and( | |
AuditEntity.or(AuditEntity.property(“title”).ilike(“JPA”, MatchMode.ANYWHERE), AuditEntity.property(“title”).ilike(“Hibernate”, MatchMode.ANYWHERE)), | |
AuditEntity.property(“p”, “name”).ilike(“Manning”))); | |
q.addOrder(AuditEntity.property(“title”).asc()); | |
List<Book> audit = q.getResultList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Book implements Serializable { | |
… | |
@ManyToOne | |
@JoinColumn(name=”publisherid”) | |
private Publisher publisher; | |
… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10:51:52,378 DEBUG SQL:92 - | |
select | |
book_aud0_.REV as col_0_0_ | |
from | |
Book_AUD book_aud0_ cross | |
join | |
REVINFO defaultrev1_ | |
where | |
book_aud0_.id=? | |
and book_aud0_.REV=defaultrev1_.REV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CriteriaBuilder cb = em.getCriteriaBuilder(); | |
CriteriaQuery q = cb.createQuery(AuthorValue.class); | |
Root root = q.from(Author.class); | |
q.select(cb.construct(AuthorValue.class, root.get(Author_.firstName), root.get(Author_.lastName))); | |
List authors = em.createQuery(q).getResultList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@NamedQuery(name = “Account.FindByName”, query = “SELECT a FROM Account a WHERE name like :name”) | |
public class Account { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = “id”, updatable = false, nullable = false) | |
private Long id; | |
@Column |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SqlResultSetMapping(name = "BookValueMapping", | |
classes = @ConstructorResult( | |
targetClass = BookValue.class, | |
columns = {@ColumnResult(name = "title"), | |
@ColumnResult(name = "date")} | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10:33:49,612 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?) | |
10:33:49,620 DEBUG [org.hibernate.SQL] – select author_.lastUpdate as lastUpda4_0_ from Author author_ where author_.id=? | |
10:33:49,644 DEBUG [org.hibernate.SQL] – update Author set firstName=?, lastName=?, version=? where id=? and version=? | |
10:33:49,646 DEBUG [org.hibernate.SQL] – select author_.lastUpdate as lastUpda4_0_ from Author author_ where author_.id=? |