Pain is the cost of Spring MVC’s elegance
I'm surprised about how far Spring has come without ever adressing simple everyday problems. If you really, honestly want to use Spring for your application all the way through, be prepared for some good shockers. Want some spring oddities?
Lets start with a question, what do you think caused this exception?
Now, you may come to the conclusion that
a.) Jetty has had a problem in transferring some streams back and forth
d.) The Hibernate Session may have been closed
c.) Space aliens hijacked your VM
...but, no - that all didn't happen. It was just the Spring way of telling me: Your Hibernate mapping needs some lazy loading if you're gonna mess around with circular dependencies. Nice one. Even better that the OpenSessionInViewFilter covered up the original error message that could've been actually helpful. Just adding @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy="user") helped me though. The time it took me to figure this out, would've bought me many a meal, had I only opted to spend it on real work.
But on to the next one: the Spring taglib. Whether you want to use the old
You think I'm joking? It gets better. Since the SimpleFormController allows only support for exactly one type of form-backing command, you will have to deal with multiple commands yourself - manually, or use a command that has nested properties - *yay*. What this means is, adding every command to the page with multiple forms, so those form:* tags don't detonate in your face. The SimpleFormController really isn't of much help here. Instead you have to mess around violently in xml hell, or abuse springs design principles to get what you need. That is, unless you take the time to bring the old MSPC modules, whose sf.net page looks pretty dead to me, up to date. This is a problem the Spring community has been struggling with for YEARS. I cannot possibly understand how it can be so hard to create something nice here. I am constantly tempted at writing my own spring extensions.
I had to vent. Overall Spring MVC isn't that bad - there are just some parts of it, you better just don't touch, lest you want to suffer a heart attack.
Update: Found a cumbersome workaround for the taglib issue.
May 23rd, 2007 - 14:31
Yep I couldn’t agree with you more. I’ve been using Spring together with Hibernate for over a year now, and if I had known then what I know now.
I’ve learned a lot from Spring, but it’s insane how much time I’ve spent tracking down even the simplest of bugs.