6 package org
.spirit
.dao
.impl
;
8 import java
.util
.Iterator
;
11 import org
.hibernate
.HibernateException
;
12 import org
.hibernate
.Query
;
13 import org
.hibernate
.Session
;
14 import org
.spirit
.bean
.impl
.BotListCatLinkGroups
;
15 import org
.spirit
.dao
.BotListCatLinkGroupsDAO
;
16 import org
.springframework
.orm
.hibernate3
.HibernateCallback
;
17 import org
.springframework
.orm
.hibernate3
.support
.HibernateDaoSupport
;
20 * This is class is used by botverse.
22 * @author Berlin Brown
25 public class BotListCatLinkGroupsDAOImpl
extends HibernateDaoSupport
implements BotListCatLinkGroupsDAO
{
28 * List the Entity Links including paging the results
30 public BotListCatLinkGroups
readGroup(final String group
) {
31 return (BotListCatLinkGroups
) getHibernateTemplate().execute(
32 new HibernateCallback() {
33 public Object
doInHibernate(Session session
) throws HibernateException
{
34 Query query
= session
.createQuery("from org.spirit.bean.impl.BotListCatLinkGroups groups where groups.categoryName = :group");
35 query
.setMaxResults(1);
36 query
.setString("group", group
);
37 BotListCatLinkGroups groups
= (BotListCatLinkGroups
) query
.uniqueResult();
39 List list
= groups
.getTerms();
40 // Ensure lazy - load is initialized
41 for (Iterator it
= list
.iterator(); it
.hasNext();) {
49 public List
readGroups() {
50 return getHibernateTemplate().executeFind(
51 new HibernateCallback() {
52 public Object
doInHibernate(Session session
) throws HibernateException
{
53 Query query
= session
.createQuery("from org.spirit.bean.impl.BotListCatLinkGroups groups");
54 query
.setMaxResults(100);
60 public List
listTerms(final BotListCatLinkGroups group
) {
61 return getHibernateTemplate().executeFind(
62 new HibernateCallback() {
63 public Object
doInHibernate(Session session
) throws HibernateException
{
64 Query query
= session
.createQuery("from org.spirit.bean.impl.BotListCatGroupTerms terms where terms.category_name = :group");
65 query
.setParameter("group", group
);