final Query query = this.mSessionFactory.getCurrentSession().createQuery("from " + PostLike.class.getName() + " where likeId = :likeId ");
query.setParameter("likeId", postLikeId);
query.uniqueResult();
위의 코드와 같이 쿼리문을 작성할때 :likeId 라고 입력하고
query.setParameter("likeId", postLikeId);
이와 같이 값을 대입해주면 가독성 좋게 구현할할 수 있다.
'Development > Web & Server' 카테고리의 다른 글
[Spring framework] 스프링의 특징 (0) | 2013.09.18 |
---|---|
[Spring framework] Controller에서 Json값으로 Retrun 하기 (0) | 2013.09.17 |
[Spring framework] Mongo DB 연동하기 (0) | 2013.09.17 |
[Spring framework] url parameters 받는 방법 (0) | 2013.09.11 |
tomcat log보기 (0) | 2013.08.29 |