From: Matt R. <ma...@ra...> - 2003-03-31 03:29:40
|
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 > |
From: Daniel B. <db...@bi...> - 2002-01-31 12:37:38
|
That was quite a large email and after reading a few times have extracted what I think is important and want to discuss more. I encourage everyone else to do the same. - Automated tests Yes they are great ... for things that can be tested. But when you start talking about developing GUI tools for Hibernate. How do you test those automatically? It's really hard. I'm not saying lets not test them, but we need to think about it if we are going to write the tests alongside the actual code, as I want to get started quite soon on some of this. I have seen a project that had automated tests that required the user to simply go a view some output. Ok, not very automated, but as good as it gets maybe? - Grouping, sum, count etc? Just a thought. I actually needed to find out how many objects existed (or how many rows in the table to put it crudely). I ended up just doing a .size() on the collection results. Is there a better way? Do any other OO query langs allow this sort of thing? - XML data binding Had a quick talk to Gavin today about this one and I think we both agree it's a feature that really needs to be done soon. I think a default mapping would be fine to get in there just so it's listed as a feature and attracts more ppl to the project. Although Gavin did mention custom mappings (and some crazy XSL template inheritence .. what an OO purist). I think getting a default mapping out soon would be great! - Visual mapping (cocoabase) Any other ppl used these tools? I used Cocoabase once and I seem to remember some sort of visual mapping tool. It had potential, but didn't really happen. I think something really funky/nice could be done for this. In theory, it could really be powerful. Imagine JBuilder and WSAD plugins as well! - MS SQL server and Informix Indeed! I can get some evaluation versions of these two databases for the weekend and have a play. Who knows .. I might even have a dialect by next week. Anyone else got immediate access to these products? Get testing! I've recently been using Hibernate in a small web project to see how well it stands up to it's claims of making your development cycle smaller/faster etc. And well, it certaintly has! I hope we can get a bit of activity in this project and more people hammering out code. Daniel |
From: Gavin_King/Cirrus%<CI...@ci...> - 2002-02-01 01:17:38
|
>- Automated tests >Yes they are great ... for things that can be tested. But when you start >talking about developing GUI tools for Hibernate. How do you test those >automatically? It's really hard. I'm not saying lets not test them, but >we need to think about it if we are going to write the tests alongside >the actual code, as I want to get started quite soon on some of this. Yeah thats an entirely sane comment. I must admit I wasn't thinking so clearly about the toolset part of the project. For the engine the tests are _essential_....but automated tests of GUIs are arguably wrongheaded (A good test should encode a functional _requirement_, not a temporary decision about how user input is gathered.) I can think of two responses: 1. The correctness of the development tools is not really as critical, and anyway not as clearly defined ... so lets not bother with tests (Tests _can_ be a maintenence nightmare) 2. Perhaps its useful to expose a _programmatic_ interface to the tools which the GUI and tests and commandline client and possibly other frontends or applications use. I'm not at all convinced of the usefulness of this - its just a suggestion. Anyways. I think its clear we dont need to be too strict about requiring tests for the toolset. cool :) >I have seen a project that had automated tests that required the user to >simply go a view some output. Ok, not very automated, but as good as it >gets maybe? Yeah I'm quite happy with that myself. I always think you get 80% of the test effectiveness without _any_ assertions....just the test running is already a big thing. On the other hand, I think that for the persistence _engine_, we will always know extremely clearly the semantics we are trying to implement ... and we will know that those semantics (and the interface) can't change without breaking client applications. So the tests shouldn't be a maintenence prob. Okay anyways lets not get too bogged down in discussions of methodology. Everyone has strong opinions and usually what happens is that things decided a priori are totally irrelevant since what actually gets _followed_ is what the developers doing all the work are comfortable with. I'd rather see good code developed haphazardly than bad code done the "right way (tm)". However, it is a major aim of this project to generate pages and pages of quality documentation. Its such a missing aspect in soooo many other open source projects. >- Grouping, sum, count etc? >Just a thought. I actually needed to find out how many objects existed >(or how many rows in the table to put it crudely). I ended up just doing >a .size() on the collection results. Is there a better way? Do any other >OO query langs allow this sort of thing? Such things would be _ace_. At present though, the query language only returns persistent objects, never properties and its not clear what the sum of a set of Customers would be :) From my brief survey .... somebody please correct me if I'm wrong on this ... i think OQL is the only OO query language that has aggregate functions. The Hibernate query language is very much a work in progress (infancy?). >- Visual mapping (cocoabase) >In theory, it could really be powerful. Imagine JBuilder and WSAD >plugins as well! yeah thats what I was touching on with the GUI mapping generator. The one tool like that I ever used (VAJ's map+schema browsers) sucked horribly but its gotta be _possible_ to do something good. An eclipse plugin would be very very nice! >- MS SQL server and Informix I betcha SQL server works immediately by using the SybaseDialect. |
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 |
From: Matt R. <ma...@ra...> - 2003-03-31 13:32:11
|
I am using this, but in order to follow the "open session in view" pattern (rather than opening/closing in each DAO's method) - it's necessary to open and pass the session from my servlets -> managers -> DAOs. Unless I'm missing something of course. Matt > 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 -- Matt Raible, Raible Designs, Morrison CO US -- Tel: +1 303 979-5340 -- Mob: +1 720 560-8460 -- Fax: +1 508 256-6471 -- Web: http://www.raibledesigns.com |
From: Dmitri C. <di...@bi...> - 2003-05-28 11:53:37
|
[cc'd to hibernate for the last paragraph] Hi Craig, > How goes it, nice to hear from you again! its going ok. <shamless-plug>I'm actually working with a friend of mine atm trying to get a small company (partnership at this stage) off the ground - set our own rules, see things done properly etc. So if anyone has any projects they'd like to see a very high quality proposal for then let me know!</shameless-plug>. > So what's Hibernate like? You using it with JBoss? Does it support all > the transactional handling of JBoss (e.g. pessimistic or optimistic > locking, and rollbacks etc), and if so, is it easy? I first looked at it a last year, but didn't really have a chance to work with it properly. For the past few months I've been using it with Tomcat as a lighter alternative to running EJBs... when developing for small businesses, being able to run on tomcat instead of requiring an EJB server saves them a few $$$. Hibernate's transactional model is very pluggable. As I understand it, Hibernate supports JTA and is well supported inside JBoss (I've cc'd this to the hibernate list where you might be able to get more info). A also believe that it supports plugging in of alternative transactional models through its own API, although I'm not sure of the status of this - its something I read on the mailing list. Re locking, it supports optimistic locking - check the docs (http://hibernate.sf.net). Version 2 betas are very stable from my experience, and I believe the only reason that version 2 hasn't been made final is for one or two pieces of functionality. Certainly worth a look. It also has good XDoclet support in XDoclet CVS. cheers dim |