If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Friday, September 24, 2010

Hibernate and Spring - Part 4

Ok.. So now that we do have our Domain Objects annotated and ready to be used, we need to write our Service or DAO layer which provides following methods for our domain objects:
  • find/query
  • delete
  • insertOrUpdate
So we already have defined our SessionFactory and HibernateTemplate. Time to make good use of it. First we define a generic interface and next a generic implementation.

One remark: Many methods are just one-1-one mapped to the typical hibernate template methods but I added some extra convenience methods like
  • findUniqueByProperty(String propertyName, Object value)
  • findUniqueByProperties(String[] propertyNames, Object[]values)
  • findListByProperty(String propertyName, Object value)
  • findListByProperties(String[] propertyNames, Object[]values)





No comments:

Post a Comment