Skip to content

Instantly share code, notes, and snippets.

@thjanssen
Last active December 29, 2017 16:06
Show Gist options
  • Save thjanssen/53ce352b379806185c71c1b9135c1fcf to your computer and use it in GitHub Desktop.
Save thjanssen/53ce352b379806185c71c1b9135c1fcf to your computer and use it in GitHub Desktop.
@Entity
@Table(name = "author", schema = "bookstore")
public class Author { … }
Author a = new Author();
a.setFirstName("firstName");
a.setLastName("lastName");
em.persist(a);
a = em.createQuery("SELECT a FROM Author a WHERE firstName = `firstName`", Author.class).getSingleResult();
06:27:24,009 DEBUG [org.hibernate.SQL] – insert into bookstore.author (firstName, lastName, version, id) values (?, ?, ?, ?)
06:27:24,022 DEBUG [org.hibernate.SQL] – select author0_.id as id1_0_, author0_.firstName as firstNam2_0_, author0_.lastName as lastName3_0_, author0_.version as version4_0_ from bookstore.author author0_ where author0_.firstName=’firstName’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment