From: Gavin K. <ga...@ap...> - 2003-03-31 10:42:54
|
I use a ThreadLocalSession in our DAO framework, to avoid this issue. ----- Original Message ----- From: "Matt Raible" <ma...@ra...> To: "'Jorge Basto'" <wea...@us...> Cc: <hib...@li...> Sent: Monday, March 31, 2003 1:29 PM Subject: [Hibernate] RE: Hibernate > This issue (using Session in method signatures) has been raised by other > users. For the time being, I don't plan on implementing a pluggable DAO > and I'm happy with Hibernate, so I haven't pursued the issue much. To > extract this and make it more generic, it might be wiser to create a > Connection object that switches based on the DAO implementation. That > is to say that it has a getConnection() method and a closeConnection() > method that does internal logic to determine what to return. You'd have > to return something like Object and then cast it down the appropriate > type in your DAO. Better ideas are welcome. > > Matt > > > -----Original Message----- > > From: Jorge Basto [mailto:wea...@us...] > > Sent: Sunday, March 30, 2003 7:56 PM > > To: mr...@us... > > Cc: wea...@us... > > Subject: Hibernate > > > > > > > > Hi Matt, > > > > Sorry to bother you yet again but I was wondering if you could > > help me out with this issue I've got. > > After "porting" your resume-hibernate example to my > > projects, I feel slightly dissatisfied with the following: > > That pattern is pretty much commited with hibernate, ie, the > > DAO signatures take hibernate sessions and there is some > > degree of hibernate "awareness" in most actions. > > > > I tried to look around the hibernate site and also other > > alternatives but it seems I cannot find a way to use hibernate > > as a 100% pluggable DAO, decoupled from the controller > > code. > > I would like the addition of hibernate to a project to leave all > > the project action's code and DAO signatures unchanged > > (ideally). It could maybe add a filter to the system, but no > > modifications to existing code were required, except for the > > actual DAO implementation. > > The thing is, supposing I want to change the DAO > > implementation BACK to say, a XML store (for some stupid > > reason ). I can ignore the hibernate session arguments of the > > DAO signatures but I would nonetheless have to carry some > > hibernate code around even if it were not being used. > > > > I am not yet very familiar with hibernate-speak so it makes it > > even harder for me to work around this issue. > > Would you have any suggestions/recommendations/links you > > could give me? > > > > Thanks > > jorge > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: > The Definitive IT and Networking Event. Be There! > NetWorld+Interop Las Vegas 2003 -- Register today! > http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |