Last active
January 19, 2017 17:05
-
-
Save thjanssen/8ada03ec785f88e5ddc32471136ad835 to your computer and use it in GitHub Desktop.
This file contains 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> | |
<persistence-unit name="my-persistence-unit"> | |
<description>Hibernate Tips</description> | |
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> | |
<exclude-unlisted-classes>false</exclude-unlisted-classes> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> | |
<property name="hibernate.use_sql_comments" value="true" /> | |
.... | |
</properties> | |
</persistence-unit> | |
</persistence> |
This file contains 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
TypedQuery q = em.createQuery(“SELECT a FROM Author a WHERE a.id = :id”, Author.class); | |
q.setParameter(“id”, 1L); | |
q.setHint(“org.hibernate.comment”, “This is my comment”); | |
Author a = q.getSingleResult(); |
This file contains 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
08:14:57,432 DEBUG [org.hibernate.SQL] – /* This is my comment */ select author0_.id as id1_0_, author0_.firstName as firstNam2_0_, author0_.lastName as lastName3_0_, author0_.version as version4_0_ from Author author0_ where author0_.id=? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment