Changes between Initial Version and Version 1 of Spring


Ignore:
Timestamp:
Nov 11, 2008, 7:18:06 AM (16 years ago)
Author:
erikvaningen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Spring

    v1 v1  
     1'''Option 1'''
     2Example of a Dao or Service object:
     3{{{
     4@Repository
     5@Transactional
     6public class HibernateClinic implements Clinic {
     7        @Autowired
     8        private SessionFactory sessionFactory;
     9}}}
     10This configuaration needed:
     11{{{
     12<bean id="erikExampleDao" class="org.geonetwork.dao.ebxml.ErikExampleDao">
     13}}}
     14
     15'''Option 2'''
     16{{{
     17public class ExampleDao extends HibernateDaoSupport {
     18        void saveErikExampleDomain(ErikExampleDomain erikExampleDomain ) {
     19                this.getHibernateTemplate().save(erikExampleDomain );
     20        }
     21
     22}}}
     23This configuaration needed:
     24{{{
     25        <bean id="erikExampleDao" class="org.geonetwork.dao.ebxml.ErikExampleDao">
     26                <property name="sessionFactory" ref="sessionFactory" />
     27        </bean>
     28
     29}}}
     30'''Chosen Option 2'''. This option is chosen because (1) one line less of configuration (2) It is working directly with the sessionFactory instead of a Facade like HibernateTemplate. Working with a template can have advantages. However in case of Hibernate, Spring has little to add because Hibernate is a very mature package. (3) SessionFactory is directly available. This might be necessary in cases of more advanced use of Hibernate.