|
|
@ -7,6 +7,7 @@ import org.hibernate.Session; |
|
|
|
import org.hibernate.criterion.DetachedCriteria; |
|
|
|
import org.hibernate.criterion.DetachedCriteria; |
|
|
|
import org.hibernate.criterion.Projections; |
|
|
|
import org.hibernate.criterion.Projections; |
|
|
|
import org.hibernate.criterion.Restrictions; |
|
|
|
import org.hibernate.criterion.Restrictions; |
|
|
|
|
|
|
|
import org.hibernate.transform.Transformers; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.orm.hibernate3.HibernateCallback; |
|
|
|
import org.springframework.orm.hibernate3.HibernateCallback; |
|
|
|
import org.springframework.orm.hibernate3.HibernateTemplate; |
|
|
|
import org.springframework.orm.hibernate3.HibernateTemplate; |
|
|
@ -41,7 +42,7 @@ public class CountServiceImpl implements CountService{ |
|
|
|
public Object doInHibernate(Session session) throws HibernateException, SQLException { |
|
|
|
public Object doInHibernate(Session session) throws HibernateException, SQLException { |
|
|
|
Query query=session.createSQLQuery( |
|
|
|
Query query=session.createSQLQuery( |
|
|
|
"select substring(created,1,10) as date,count(*) as count from "+c.getSimpleName()+" group by substring(created,1,10)"); |
|
|
|
"select substring(created,1,10) as date,count(*) as count from "+c.getSimpleName()+" group by substring(created,1,10)"); |
|
|
|
return query.list(); |
|
|
|
return query.setResultTransformer(Transformers.aliasToBean(Count.class)).list(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|