Hi all.
I'm in the early stages of learning Groovy and how to use it in the context of each layer in a typical web application (controllers, services, daos).
I'm trying to find out the best way of representing the following in Groovy.
I'm sure there is a way to simplify this in Groovy, but I'm having problems with how to represent the HibernateCallback class as a closure. Any help is appreciated.Code:return (Integer)getHibernateTemplate().execute( new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException,SQLException { def query = session.createQuery("select count(*) from TestObject"); return ((Long)query.iterate().next()).intValue(); } }); }
-brad


Reply With Quote