====== Hibernate ======
* [[https://plus.google.com/+GavinKing/posts/LGJU1NorAvY|Just because you're using Hibernate, doesn't mean you have to use it for everything. A point I've been making for about ten years now. - Gavin King]]
* [[java:hibernate:4|Hibernate 4]]
* [[java:hibernate:5|Hibernate 5]]
* [[java:hibernate:test|Hibernate Test]]
* [[java:hibernate:자동생성|Hibernate와 값의 자동 생성]]
* [[http://neilhan.blogspot.com/2006/11/spring-hibernate-and-mysql-replication.html|Spring Hibernate and MySql Replication]]
* [[http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Web_Platform/5/html/Hibernate_Annotations_Reference_Guide/entity-hibspec.html|Hibernate Annotation extensions]]
* [[http://javacan.tistory.com/entry/Hibernate-36%EC%97%90%EC%84%9C-JPA%EC%9D%98-EmbeddedId-%EC%82%AC%EC%9A%A9%EC%8B%9C-%EC%98%A4%EB%9D%BC%ED%81%B4-count-%EA%B4%80%EB%A0%A8-%EC%98%A4%EB%A5%98|Hibernate 3.x 복합키 사용시 count() 쿼리 오류 발생]]
* @IdClass 혹은 @EmbeddedId 같은 복합키를 사용하면서 count() 쿼리를 사용할 때 오류가 발생한다.
* 쿼리가 count((follow0_.FOLLOWING_ID, follow0_.USER_ID))
이런식으로 생성된다.
* Hibernate 4.1로 바꾸면 해결된다.
* [[http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html|Hibernate Configuration]] : 설정 properties 등을 볼 수 있다.
* [[http://docs.jboss.org/hibernate/core/4.3/devguide/en-US/html/apa.html|Appendix A. Configuration properties]]
* [[http://java.dzone.com/articles/hibernate-facts-integration|Hibernate Facts: Integration Testing Strategies ]]
* [[http://docs.jboss.org/hibernate/orm/4.3/javadocs/org/hibernate/cfg/NamingStrategy.html|NamingStrategy]] Table, Column 이름 자동 생성 전략 인터페이스
===== Query Comment =====
* [[http://stackoverflow.com/questions/3196975/how-to-put-a-comment-into-hql-hibernate-query-language|How to put a comment into hql hibernate query language]]
true
Query query = ...;
query.setComment("Some comment here");
===== Lazy Loading Field Load =====
* Lazy Loading 필드를 강제로 바로 로딩하고자 한다면,
* ''Hibernate.initialize(entity.getLazyCollection());'' 형태를 사용해본다.
===== ":" Escape =====
* [[https://hibernate.atlassian.net/browse/HHH-2697|[HHH-2697] Can't use := for variable assignment within a SQL-Statement - Hibernate JIRA]]
* SQL 문장 자체에 ":"이 있을 경우 HQL의 파라미터 매핑 ":"과 혼동이 있을 수 있다. 이때 SQL 문장의 ":"는 ''\\:''으로 이스케이프하면 된다.
SELECT k.`news_master_id` AS id, @row \\:= @row + 1 AS rownum
FROM keyword_news_list k
JOIN (SELECT @row \\:= 0) r
WHERE k.`keyword_news_id` = :kid
ORDER BY k.`news_master_id` ASC
===== 참조 =====
* [[http://vladmihalcea.com/tutorials/hibernate/|Hibernate Tutorials | Vlad Mihalcea's Blog]]
* [[http://www.javacodegeeks.com/2015/03/hibernate-tutorial.html|Hibernate Tutorial – The ULTIMATE Guide | Java Code Geeks]]
* [[http://www.tutorialspoint.com/hibernate/index.htm|Hibernate Tutorial]]
* [[http://vladmihalcea.com/tutorials/hibernate/|Hiberante Tutorial]] 성능, Cache 관련 부분 꼭 읽어볼 것.
* [[http://fruzenshtein.com/hibernate-join-table-intermediary/|Hibernate: Bidirectional example of @JoinTable annotation]]
* [[http://www.thoughts-on-java.org/tips/|Hibernate Tips - Thoughts on Java]]
* [[http://www.thoughts-on-java.org/hibernate-best-practices/|Hibernate Best Practices]]
* [[https://www.javacodegeeks.com/2018/03/different-hibernate-naming-strategy.html|Different Hibernate Naming Strategy | Java Code Geeks - 2018]]
* [[https://www.baeldung.com/hibernate-entity-lifecycle|Hibernate Entity Lifecycle | Baeldung]]
* [[https://vladmihalcea.com/spring-read-only-transaction-hibernate-optimization/|Spring read-only transaction Hibernate optimization - Vlad Mihalcea]]