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SBzaW5n bGUgbWFjaGluZS4NCglXSVRIT1VUIFJFQk9PVElORyEgTWl4IExpbnV4IC8gV2luZG93cyAvIE5v dmVsbCB2aXJ0dWFsIG1hY2hpbmVzDQoJYXQgdGhlIHNhbWUgdGltZS4gRnJlZSB0cmlhbCBjbGlj ayBoZXJlOmh0dHA6Ly93d3cudm13YXJlLmNvbS93bC9vZmZlci8zNTgvMA0KCV9fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQoJU3ByaW5nZnJhbWV3b3JrLWRl dmVsb3BlciBtYWlsaW5nIGxpc3QNCglTcHJpbmdmcmFtZXdvcmstZGV2ZWxvcGVyQGxpc3RzLnNv dXJjZWZvcmdlLm5ldA0KCWh0dHBzOi8vbGlzdHMuc291cmNlZm9yZ2UubmV0L2xpc3RzL2xpc3Rp bmZvL3NwcmluZ2ZyYW1ld29yay1kZXZlbG9wZXINCgkNCg0K |
|
From: <jue...@we...> - 2003-08-22 10:46:00
|
Hi Lars, I'm glad that you finally succeeded in making it work :-) > I've change the MySQL stuff to Postgres - no problem. At this point I = do NOT provide the database table for the example object. The application starts up fine and does not tell me anything about a mapping problem. Is this the default behaviour ? Yes, this is *Hibernate's* default behavior. It prepares the respective = statements on startup but does not valdidate them. You will detect = mapping syntax errors but not inconsistencies with the data model. > Another question about WebWork (2). I know the difference about Spring = and WebWork and that it's 'no problem' to combine the two frameworks.=20 But does it make any sense ? Is WebWork MVC superior ? IMO it does make more sense to stay with Spring alone so you don't have to deal with two technologies. You're right, of course - I don't *recommend* a WebWork/Spring combo. = Most people that do such combos with Struts or WebWork have investments = in the latter, possibly migrating existing applications. WebWork uses a specific command-style programming model for actions = while Spring recommends singleton-style reusable controllers. Spring = supports both models, though: You can achieve the command-style model = through declaring your Spring controllers as prototypes (<bean id=3D".." = singleton=3D"false"). Struts obviously has a lot of tag libraries and code generation tools, = so that may be another reason to choose it besides existing investments. = I'm not a great fan of Struts' programming model (Action, ActionForm) = though, so I recommend Spring's web MVC if there aren't any other = reasons involved. Juergen |
|
From: Lars F. <lar...@gm...> - 2003-08-22 10:17:17
|
Hi Jürgen, you're just too smart ... My previous mail explaining the error somehow got lost in cyberspace. Still don't know what I was struggling with. It just doesn't make any sense (that it doesn't work) and that's why I was so frustrated. Just started everything from scratch (and I mean everything - even wrote a new build.xml). Before I used the tutorial as starting point. The example behaves as expected, there's only one thing I'm wondering about: I've change the MySQL stuff to Postgres - no problem. At this point I do NOT provide the database table for the example object. The application starts up fine and does not tell me anything about a mapping problem. Is this the default behaviour ? Another question about WebWork (2). I know the difference about Spring and WebWork and that it's 'no problem' to combine the two frameworks. But does it make any sense ? Is WebWork MVC superior ? IMO it does make more sense to stay with Spring alone so you don't have to deal with two technologies. Thanks Lars > Hi Lars, > > I don't know what you're struggling with - m > apping a hbm file should be pretty simple. I even get a n > ice error message when specifying a wrong one. I guess yo > u're rather struggling with Hibernate than with Spring, b > ut I can't really judge as you didn't provide any details > . Did you manage to set up Hibernate *standalone*, for ex > ample? Does the web app with Spring start up standalone, > without your LocalSessionFactoryBean? > > I've attached a > simple setup of a Spring/Hibernate web app, just includi > ng a 1-listener web.xml, a 2-bean application context, 1 > hbm file, and one persistent class file. That should star > t up, Hibernate will just complain that it can't access M > ySQL at the specified port for extracting meta data - but > startup will proceed. You'll see in the log if the hbm g > ets loaded, you can also try to break it and see if Hiber > nate complains on restarting. > > Regarding WebWork: WebW > ork and especially WebWork2 are nice web frameworks, no d > oubt. But you definitely won't any particular middle tier > support, not in terms of transactions and not in terms o > f persistence. It might even make sense to use Spring as > middle tier framework in combination with WebWork for the > web tier, if you don't like Spring's own web MVC. There > are already people doing that, even more with Struts for > the web tier. > > There are numerous companies using a Sp > ring/Hibernate combo for various applications, including > the one that I'm with. Admittedly, my main experience is > with Tomcat and Resin, but WebLogic should work nicely to > o. Try it with a local DataSource first, as I've done in > the simple setup that I've attached. Provide me with deta > ils on errors that you encounter. All things considered: > Don't give up :-) > > Regards, > Juergen > > > > -----Ur > sprüngliche Nachricht----- > Von: Lars Fischer [mailto: > lar...@gm...] > Gesendet: Do 21.08.2003 15:04 > > An: spr...@li... > > Cc: > Betreff: [Springframework-developer] Giving up > > > > Finally I've wasted to much time trying to get S > pring work with Hibernate > without an example about conf > iguration. > > Never had so many problems using a frame > work despite the fact that this one > is better documente > d than most of the rest. Documentation is just too > abst > ract > at the moment to help with real world problems. I > just can't get Spring to > map my *.hbm.xml file defined > under 'mappingResources'. Even worse I don't > get any > > kind of useful error message. Maybe this is a BEA problem > with reading > configuration > inside of the war, maybe > not. > Maybe I'll continue if there's a working example w > ith Hibernate (all I would > need is > a COMPLETE configu > ration example). IMO the skeletons are not very useful. > > On the other hand I don't want to wait until October > so I'll take a look > at WebWork2. I could solve all my p > roblems with WebWork 1 myself without > documentation. > > > Thanks a lot for helping me in the past. > Lars > > > > > > ------------------------------------------------- > ------ > This SF.net email is sponsored by: VM Ware > Wit > h VMware you can run multiple operating systems on a sing > le machine. > WITHOUT REBOOTING! Mix Linux / Windows / No > vell virtual machines > at the same time. Free trial clic > k here:http://www.vmware.com/wl/offer/358/0 > ___________ > ____________________________________ > Springframework-de > veloper mailing list > Spr...@li... > urceforge.net > https://lists.sourceforge.net/lists/listi > nfo/springframework-developer > > |
|
From: Colin S. <col...@ex...> - 2003-08-23 04:04:05
|
Lars Fischer wrote: >Hi Jürgen, > >you're just too smart ... > >My previous mail explaining the error somehow got lost in cyberspace. > >Still don't know what I was struggling with. It just doesn't make any sense >(that it doesn't work) and that's why I was so frustrated. > >Just started everything from scratch (and I mean everything - even wrote >a new build.xml). Before I used the tutorial as starting point. > >The example behaves as expected, there's only one thing I'm wondering >about: > >I've change the MySQL stuff to Postgres - no problem. At this point I do >NOT provide the database table for the example object. The application >starts up fine and does not tell me anything about a mapping problem. >Is this the default behaviour ? > >Another question about WebWork (2). I know the difference about Spring and >WebWork and that it's 'no problem' to combine the two frameworks. >But does it make any sense ? Is WebWork MVC superior ? >IMO it does make more sense to stay with Spring alone so you don't have >to deal with two technologies. > > For anybody that hasn't decided on a web ui tier, I would also highly recommend Apache's Tapestry. Tapestry is a component oriented framework (somewhat similar to the web layer in Apple's WebObjects), where ui elements are java components, and components and pages have a full lifecycle and remember their state, while still working efficiently in a web environment. I think it's significantly higher level way of doing a web ui than the like of Spring's mvc framework or WebWork (never mind Struts, a truly mediocre framework in my opinion). Since Tapestry also does runtime code instrumentation, there is an easy mechanism to bring in beans from Spring context into Tapestry pages and components in a declarative fashion, maintaining inversion of control. Negatives include the fact that some of the concepts in Tapestry are hard to get your mind around if all you are used to is the traditional web ui approaches. I think it takes a good day or two to 'grok' tapestry. On the documentation side, there is a book by the author (to be published by Manning) coming out in a few months. Other than that, there is documentation ranging from excellent (component guide) to decent (usage guide) to out of date (most of the rest). There are some excellent examples though. Early next week I am going to try write a document describing some best practices for combining Spring and Tapestry. Hopefully that will be of use to anybody else that wants to combine these two excellent frameworks. Colin |