|
From: Colin S. <col...@ex...> - 2004-07-15 13:57:35
|
I don't like that solution, because it will then also affect any HibernateTemplate that is passed in. The current code does not touch any template that is passed in. These changes do not want to modify that behaviour, but rather allow the default value for allowCreate on _new_ templates created to be specified. And I think there are two ways that people would want to play with the flag: either make their own subclass which sets the flag to false, and that becomes the superclass of all their DAOs, or alternately, do not use a subclass at all, but in some (or all) DAOs, specifically set the default value. Colin jürgen höller [werk3AT] wrote: >Colin, > >What about simply invoking > > getHibernateTemplate().setAllowCreate(false); > >in the initDao implementation of your subclass? > >Juergen > > >________________________________ > >Von: spr...@li... im Auftrag von Colin Sampaleanu >Gesendet: Do 15.07.2004 05:34 >An: spr...@li... >Betreff: [Springframework-developer] HibernateDaoSupport > > > >Juergen, > >The existing code in HibernateDaoSupport created a HibernateTemplate >with the allowCreate flag as true by default, and as the >setSessionFactory method where the template was created was final, there >was no way to override this. I have created a protected field called >defaultTemplateAllowCreateValue (true by default to maintain existing >behaviour), which a user HibernateDaoSupport subclass may override. >Additionally, I have added a setter for this default value, so a DAO >instance can be set to true or false specifically (without having to >subclass). This value does not affect any HibernateTemplate passed in >explicitly. > >Colin > > |