Categorize this one under thematically similar project names leading to seasonal irony.
How much does Hibernate seemingly despise Spring? So much that they no longer acknowledge that Spring is a “Related Project”. Just today, Christian Bauer (core Hibernate developer and website maintainer) removed all references of Spring from this page in their wiki. Nevermind that for a good percentage of J2EE developers, Hibernate and Spring are like chocolate and peanut butter. Of course, this kind of editorial exorcism isn’t unprecedented for Hibernate; they previously heavily edited, then removed completely, the Spring integration page (no longer available) on their wiki. I guess it’s hard to blame JBoss (Hibernate’s owning company) for desiring perpetual winter (and never Christmas?); Spring’s popularity is due in no small part to its promise of successful Java enterprise development sans EJBs and, thus, the managed containers (like the JBoss Application Server) required to deploy them.
All this head-burying and ear-covering from the Hibernate camp is rather humorous to watch. It becomes less of a laughing matter, however, if Hibernate ever takes practical steps to cripple itself when used outside the context of the JBoss AS. Hopefully, standardization around OR/M persistence with JSR-220 and the javax.persistence API will help keep Hibernate honest in this regard. But then, you never know what kind of wacky stunts these guys are likely to try.
Amen.
I think this is really the JBoss influence on Hibernate. JBoss wants people to use EJB3 when it’s available but Spring offers a way to avoid EJB compexity now.
(1) We have already explained in other places that we dislike the noisy, inelegant HibernateTemplate stuff that Spring tries to promote. Everyone using use this stuff today should seriously reconsider. Until Spring redesigns their Hibernate integration stuff, we simply cannot recommend it to our users. Some people think we should still recommend Spring to people, even though we think the Hibernate integration is flawed. This would be sacrificing honesty for popularity. We don’t believe in popularity contests, and in the past have often take politically unpopular points of view that were later proven right.
(2) I think it’s a pretty clear matter of public record that the Spring and Hibernate teams fell out well over a year ago when Spring guys started publicly attacking our work on the JSR-220 spec. We have made several genuine private overtures to repair these differences, but apparently no-one on the Spring team is interested in being friends again. So, certainly there is a layer of personal mistrust involved here, but I promise that we won’t allow that to influence our technical or product decisions. Certainly nobody “hates” anybody here. We so have a pretty deep difference of opinion.
(3) It is obviously true that we desire the success of EJB 3.0, and hence the continued existence of EJB and J2EE, the prospect of which you characterize as “perpetual winter”. I’m very happy that future will prove us right on this one. Already, Emmanuel and I are swamped with email raving about how great our EJB 3.0 preview implementation is. One day you will probably write an EJB3 app. That day, you will realize why we wanted to fight so hard to make EJB3 a reality. I’ll let history judge us here.
(4) It’s very funny that you make the utterly groundless accusation that we are being “kept honest” by the spec that we were a major force behind the creation and promotion of. (This spec has sucked up most of my time over the past year.) Apparently we are kept “honest” by our own work (!). Do you realize how incoherent that notion is? Furthermore, it is a fact that we have never, ever made the slightest attempt to tie Hibernate to JBoss, and that even the JBoss EJB3 container runs outside of JBoss AS! In fact, we have on many, many occasions stated publicly that Hibernate would never become dependent upon JBoss AS. You have not a skerrick of evidence for claiming that we will do otherwise. If I could be bothered, I would demand an apology from you for such a totally unfounded and unfair characterization of our motives. But actually I’ll just laugh, knowing that your prediction will again by proved wrong by history.
(5) It’s even funnier that you refer to the creation of a credit system for the Hibernate forum as a “wacky stunt”. This system is a roaring success, has been totally embraced by our userbase, and really has successfully fostered a true sense of community where users help each other out. This means that free users are getting much better support than they were getting before (of course, the Hibernate team does not have time to personally answer every question in the Hibernate forum). This is by far the smoothest forum activity I have ever seen in the past 3 years. If you think this system is “wacky”, please explain why you think you deserve an unlimited amount of free help if you are never willing to help out other people in return.
(6) In the past six months, Hibernate has been adopted as an enterprise standard in some of the worlds largest companies; activity on our website has doubled *yet again*; we have delivered a slew of long-promised things, including Hibernate 3.0, Hibernate EntityManager and Hibernate Annotations (and we have more new stuff in the pipeline). This project is wildly successful. Cause of triumphalism perhaps, but tempered by a feeling of responsibility and gratitude to our users. Of course, blog posts like this one represent a tiny minority conspiracy-theorist-type view. But, in case people reading this are inclined to believe in our evident evilness and attribute to us the kind of cynical short-term self-interestedness that this blogger does, let me be very clear that we take incredibly seriously our responsibility to continue to provide great technology without the “strings” of vendor lock-in, software licence fees, horrible support and slow product development lifecycles.
Geez Gavin, take a pill would you – you’re starting to sound like Marc Fleury.
OK Hibernate guys, you think the Hibernate template sucks? Come up with a better one! Everyone outside of the JBoss company thinks that the HibernateTemplate is fine. It reduces lines of code required, supports switchable transaction strategies and makes business logic code implementation neutral. We know the last feature scares you, but the users want it.
Your replacement needs to have all the features of the Spring one – including the fact that business logic code is ORM neutral.
I bet you can’t do it.
> OK Hibernate guys, you think the Hibernate template sucks? Come up with a better one!
We have already offered several better alternatives:
For EJB 2.x environments, just use SessionFactory.getCurrentSession().
For EJB 3.x environments, we have designed a MUCH more elegant solution than anything else available today. Read the spec, and try out EJB3.
For use outside the J2EE server, try out the JBoss Embeddable EJB3 container.
For any of these solutions, all exception handling, session management and transaction management are done for you. Without the noise.
If you are really, truly, interested in “reduc[ing] lines of code)”, instead of just spouting anonymous stuff on blog comments, I encourage you to actually *try out* these alternatives, and see how much better they are.
> supports switchable transaction strategies
Hibernate (1.x and above) already abstracts the underlying transaction mechanism (JTA/JDBC/whatever). Have you actually used Hibernate?
> makes business logic code implementation neutral.
The Spring HibernateTemplate does not do this. In fact, HibernateTemplate exposes very Hibernate-specific APIs. Again, have you actually used it?
> We know the last feature scares you
Um no, it doesn’t. Quite the contrary. That’s why we created Hibernate EntityManager.
> including the fact that business logic code is ORM neutral.
No framework makes persistence code “ORM nuetral”. You really have swallowed a line of nonsense if you believe that one. Certainly the Spring HibernateTemplate does not magically do this. Your only real chance to have portable persistence code is to adopt EJB 3.0 persistence.
If, on the other hand, by “ORM nuetral”, you simply mean seperating business logic from persistence logic, then that is a trivial problem: simply wrap persistence logic in a DAO layer. please refer to Hibernate in Action if you don’t know how to write a DAO.
Another reason for me to start the next new project using iBATIS (like the last one).
We gave up JBoss a few years ago because of the bad attitude of these people.
You know Gavin, you just don’t get it do you.
I totally agree with #5 and I’m beginning to agree with #7.
I’m glad Spring supports other data products like OJB and iBatis because I would much rather stick with Spring than stick with Hibernate or move to EJB. With attitudes like those in the JBoss company, if I move from Hibernate, I wouldn’t move to a product made by JBoss folks. Even this thread proves they don’t care about users.
To help you out, I’ll explain what I think #5 was saying:
“For EJB 3.x environments, we have designed a MUCH more elegant solution than anything else available today. Read the spec, and try out EJB3.”
EJB3 isn’t real yet. It’s beta. The spec isn’t finished. We know jboss people like to put beta and alpha code in prod, but in the real world, companies with enterprise systems don’t.
“Hibernate (1.x and above) already abstracts the underlying transaction mechanism (JTA/JDBC/whatever). Have you actually used Hibernate?”
Spring abstracts all the transaction stuff completely out of the code. With Hibernate, you have to write code for transaction handling, right? I’ve read Hibernate in Action.
“The Spring HibernateTemplate does not do this. In fact, HibernateTemplate exposes very Hibernate-specific APIs. Again, have you actually used it?”
It doesn’t expose it to your business logic. Sorry Gavin, database access code is not business logic. The two shouldn’t be mixed. If I use Hiberate out of the box, I’ll have to write code at the service layer to handle transactions. With Spring it’s all declarative so no Hibernate-specific APIs anywhere except inside DAOs where they belong.
I’ll admit I haven’t used EJB3 stuff. I don’t plan to. I’d say that most Java users don’t plan to. Right now, I’ve been using Hibernate 3 with Spring and it meets my needs. If you break Hibernate so it no longer works with Spring, I’ll switch to OJB or iBATIS.
By the way, neutral is spelled neutral, not “nuetral”.
> You know Gavin, you just don’t get it do you.
No, I don’t. I truly don’t get why the fact that we write software that lots of people find useful, give it away for free, and have a website which we sometimes make changes to makes people hate us so much that they have to write blog posts attacking us.
Yes, it is true that we have an opinion about the Spring Hibernate integration. Many people have opinions about software products and frameworks. Is it usually considered unacceptable to have an opinion? No. Did we dishonestly or unfairly attack Spring anywhere? No. In fact, did we even attack Spring at all, apart from removing some out-of-date information from our own website? No. Did we do anything to force people to come to our website and download our software and use it? No.
> Spring abstracts all the transaction stuff completely out of the code. With Hibernate, you have to write code for transaction handling, right?
Wrong. Try Hibernate3+EJB2 or EJB3. Really, when you tell someone they “don’t get it”, it helps to have your own facts straight.
By the way “supports switchable transaction strategies” is not in any way related to “abstracts all the transaction stuff completely out of the code”, so you are talking about something completely different to the first anonymous poster.
> EJB3 isn’t real yet. It’s beta
EJB3 is in public review and our implementation works very well. Go to the Hibernate and JBoss forums and you will see many people using it successfully.
> We know jboss people like to put beta and alpha code in prod, but in the real world, companies with enterprise systems don’t.
Oh you “know” this. So, do you have a single example of “jboss people” putting alpha code into production? I have never seen or heard of such a thing. (Beta code is a different matter. Many organizations are quite happy to deploy beta products after thorough testing. Many others aren’t. It’s up to you. Depends upon the quality of your QA process, I guess. And perhaps upon how mission critical the application is.)
But who here is talking about putting code in “prod”? I never once mentioned the word. Neither did any of the other posters. Real world companies with enterprise systems are making decisions about what infrastructure to use for development of *new* applications that will go into production 6 months to a year from now, well after the spec is finished and final, and well after our implementation is mature. Straw man.
> Sorry Gavin, database access code is not business logic.
Excellent, we agree on something. The first anonymous poster seemed confused on this point.
> With Spring it’s all declarative so no Hibernate-specific APIs anywhere except inside DAOs where they belong.
Exactly. It is the DAO that is useful. Not the HibernateTemplate. Which was the very point I made in my earlier post. The first poster confused HibernateTemplate (which is Hibernate specific) with seperation of concerns (which is handled by DAOs).
By the way, there is absolutely no reason on earth why you need a framework to be able to have DAOs. There is not much a framework can do for you here.
> I’ll admit I haven’t used EJB3 stuff.
Ah, so basically, for all you know, I might be utterly correct and EJB3 truly is a much more elegant solution. You don’t know and you apparently don’t care. But somehow you still know I’m motivated by evilness and selfishness to make this claim.
Like you said: “I don’t get it”. Sheesh. What did I do to you, man?
How about this compromise solution: you obviously don’t like me and don’t trust the things I say. So how about *you* just ignore me. If I’m so untrustworthy, it’s obviously not worth the effort of reading my stuff anyhow. In return, I won’t force you to use Hibernate or EJB3, or come to our website, or ever read anything else we write. Nor will I prevent you from using Spring or any other damn thing you like to use.
Deal?
‘Cos I’m simply not going to stop giving honest, well-intentioned advice to the rest of the Hibernate user community just because you get offended by people having an opinion that is different to yours.
> If you break Hibernate so it no longer works with Spring…
Oh please, we of course will not do this (I don’t even know how we could). This is a total strawman. The only person who ever mentioned us somehow magically breaking Hibernate/Spring integration was the original blogger, and he offered zich evidence for how this was likely or even possible. No-one on the Hibernate or Spring teams has ever raised this as a possibility.
Apparently you believe we are some kind of evil people who like to screw our own user community and make life hard for others. And that we think somehow this would work to our own benefit (?!).
> … I’ll switch to OJB or iBATIS.
Please do. In fact, do it today. Frankly, I don’t like it when people who think we are so evil and selfish as you do are using our stuff and having the benefits of our hard work. We make free software for Nice People.
> By the way, neutral is spelled neutral, not “nuetral”.
Proof! JBoss is evil! They can’t even *spell* “neutral”. (And they certainly aren’t *good*.) So there’s only one remaining logical possibility!
[quote]We have already explained in other places that we dislike the noisy, inelegant HibernateTemplate stuff that Spring tries to promote. Everyone using use this stuff today should seriously reconsider. Until Spring redesigns their Hibernate integration stuff, we simply cannot recommend it to our users.[/quote]
For the record, we have been supporting Hibernate3’s SessionFactory.getCurrentSession() style since its introduction in Hibernate 3.0.1. Our ORM chapter in the reference docs even has a dedicated section on using plain Hibernate3 API to implement DAOs, which is a fully supported alternative to the classic Spring HibernateTemplate style. Spring’s transaction management will work perfectly well with that style, both within and outside a J2EE environment.
Juergen
For completeness: We also support DAOs based on plain JDO API, TopLink API, iBATIS API – see our reference docs for details. In general, there are always both options: using a Spring template class or using the respective tool’s native API. We leave the choice up to the application developer.
Data access APIs that we don’t recommend using the _plain_ native API for are: JDBC and Hibernate2, due to the resource handling and checked exceptions involved there. It’s of course possible to work at the respective native API level, but usually in combination with data access templates that handle resource management and exception translation.
> For the record, we have been supporting Hibernate3’s SessionFactory.getCurrentSession() style since its introduction in Hibernate 3.0.1.
Great, so will you *please* now deprecate HibernateTemplate?
Wow. I spend my weekend remodeling and chasing after my toddler, and you guys get all frothy on me!
Gavin and Juergen, thanks a bunch for replying. I appreciate your input and insight.
Gavin: I’m surprised at your response(s), on many levels. I’m going to try to detail all of my surprises here. I hope you’re still reading, and willing to participate. You’ve obviously spent a good deal of time reading and responding to others’ posts. I hope you’ll give this entry the same consideration.
First, I’m surprised you think I hate Hibernate. I certainly don’t hate Hibernate, not even in the way you don’t hate Spring. My post merely expressed bemusement towards Hibernate, and was at worst flippant, mildly irreverant, and harmlessly speculative. I merely pointed out evidence of the continuing distance Hibernate is putting between itself and Spring, claiming this seems like an odd thing to outside developers, and offering theories as to why this disassociation is taking place.
I’m also surprised you think I attribute “evil” to Hibernate. The only real evil I associate with Hibernate is arrogance, and I don’t think there’s much argument there. There’s no doubt Hibernate is an incredibly powerful library with rich documentation, and our product is better for the use of it. However, my opinion of JBoss is certainly less rosy, and, again, this isn’t exactly a viewpoint unique to me. So, I think it’s a bit disingenuous to apply the label “conspiracy theory” to my suggestion that it’s JBoss that doesn’t want Spring recommended on their website. It seems only natural for a business to avoid recommending their competition. In fact, that’s why the change to the “Recent Projects” page on your wiki is even noteworthy. If Hibernate were still a project independent of JBoss, I believe it’s fair to assume this would never have happened. Spring and Hibernate are orthogonal development efforts that work well with each other. Spring seems like they would be an obvious first choice for Hibernate’s “Related Projects” page. However, with JBoss in the mix, there seems to be a tension between the projects that wouldn’t otherwise exist. This is clearly an outsiders view; there may have been tough relations between the two projects before JBoss entered the picture. But if you believe my interpretation of these relationships is held by a “tiny minority”, you’re kidding yourself.
I’m also surprised that you think I want “free support” because I suggested your forums’ credit system was “wacky.” I admit being out of line in calling it a “stunt”, but I’m standing by the wacky. I’ve been working with open source software for many years, both as producer (though certainly not on a project with the scope and reach of Hibernate) and consumer. I’ve both lurked and participated on many mailing lists and forums. And I’ve never seen this kind of approach to encouraging “community” before. I’m really glad it’s working for you guys, but I’ve seen many projects enjoy success and a rich participant community without it. Maybe you guys will trailblaze with this model and it’ll become the new norm for large free software projects. Until then, I’m sticking with wacky.
As to the “free support” accusation, that one I take personally. You may be surprised to hear I try very hard to be a responsible Hibernate developer: I’ve read “Hibernate in Action” cover-to-cover (and I’m anxiously awaiting the next edition), I’m constantly digging through the online reference documentation, I search JIRA and the forums to make sure any problem I’m having hasn’t already been addressed, I’ve spent a good amount of time deep in the Hibernate source trying to figure out what it’s doing, and, as is clear from this post, I keep up with the wiki and the changes made to it. As such, at my company, I’m Hibernate’s biggest advocate. I had to fight for months to get Hibernate into our project, and I’m the local expert whenever anyone has any problems with it. Sometimes I feel like my whole day is spent either teaching someone how to use Hibernate or defending why we want in our product in the first place. Since I’m the Hibernate support person for our entire engineering team, please forgive me if I don’t spend my freetime hanging out in Hibernate’s forums doing the same. But, as a responsible participant in this and other open source projects, I don’t hesitate to report bugs and supply patches. However, my first foray into bug-reporting for Hibernate was less than encouraging. When I did find what I thought was a problem with Hibernate, I filed a bug and submitted a patch. The response I got? Nothing more than “I’m not inclined to fix this” and the summary closing of the issue.
Which leads to my biggest surprise of all. You spent a good part of your weekend writing copious amounts of comments on my tiny little blog, additionally replying to anonymous posters who, among other things, attacked your spelling. Yet you gave seemingly precious little time to my bug report and associated patch, which (I thought) was clear, concise, and had a safe and simple solution. Even if my bug was based on false assumptions, it would’ve been incredibly helpful to give a brief explanation why.
So, for better or worse, Hibernate and Spring don’t get along, despite the fact that everyone else just loves mushing them together. JBoss looms, though their influence may or may not be as nefarious as I imagine it. And you seem to invest way more time replying to mildly critical blog posts than bug reports. Regardless, we’ll keep using Hibernate, and I’ll keep trying to submit bug reports and patches as necessary. When I get one accepted, we’ll throw a little party at my office, and I’ll offer up a toast to you. 🙂
[quote]> For the record, we have been supporting Hibernate3’s SessionFactory.getCurrentSession() style since its introduction in Hibernate 3.0.1.
Great, so will you *please* now deprecate HibernateTemplate?[/quote]
No, as we don’t see a compelling reason to do so. HibernateTemplate is a pure option anyway, not a requirement of Spring’s Hibernate support or any other part of the framework. It’s in particular completely orthogonal to Spring’s SessionFactory setup and transaction management facilities. And it’s a straightforward option for people migrating from a Hibernate2 HibernateTemplate based app.
We do consider the Hibernate 3.0.1+ getCurrentSession style as important, and we have been supporting it as a first-class option since Spring 1.2 final! It’s an obvious option for anybody looking at our current reference docs. We would even have provided that support in Spring 1.2 RCs if Hibernate would have had that API feature in Hibernate3 RCs and 3.0 final already, but it unfortunately didn’t.
However, HibernateTemplate and its automatic translation to a generic data access exception hierarchy _is_ valuable for projects that prefer to avoid implementation-specific imports above the DAO interface layer. It’s about localizing Hibernate dependencies in a project’s code base, and about throwing fine-grained exception subclasses that also apply to other persistence tools (such as JDBC or iBATIS).
Some projects may need to handle specific data access exceptions or at least prefer to have the option to do so: HibernateTemplate is a very useful option for them, either through its convenience methods or through inner-class HibernateCallbacks – which even naturally work at the native Hibernate Session API level, just in a callback fashion.
Other projects may not consider generic data access exceptions as important: Hibernate 3.0.1+’s native getCurrentSession mechanism is a good option for those. Of course, that style isn’t that different from the HibernateTemplate+HibernateCallback style in the first place: It’s really only where to put the implementation code; the actual Session access code would be identical.
Juergen
Links: 8-15-2005
mockhaug » Hibernate hates Spring The hibernate guys removed references to Spring on their site, Gavin (Hibernate) and Juergen (Spring) go at it. (categories: hibernate spring ) IntelliJ IDEA Open Source License IntelliJ IDEA Open Source Licenses are…
> it’s JBoss that doesn’t want Spring recommended on their website. It
> seems only natural for a business to avoid recommending their
> competition.
Do you believe every single blog you read? JBoss does not compete with Spring. When are you people going to get this? You’d have to go back to JBoss 1.0 back in 1999/2000 when JBoss was just an EJB container. JBoss has said over and over again that Spring compliments JBoss JEMS products. It even compliments EJB3.
BTW, What really lit a fire under Hibernate to get rid of the need of Spring support was the following:
http://www.theserverside.com/news/thread.tss?thread_id=32172#159077
It is extremely annoying that the Springframework.COM had made such a big deal over such a trivial piece of code. THIS is what annoys JBoss. Stick to IoC and stop promoting simple trivial integration code and making Hibernate users believe they cannot live without it. As Vagif Verdi states in the above TSS thread, stop tying people to Spring and instead work with Hibernate and other projects to improve their APIs to alleviate the need for this trivial integration code. Better yet: SUBMIT CODE to projects like Hibernate.
Bill
Hi, Bill! Thanks for joining in.
Nope, I don’t believe every blog I read, not even my own. My belief that Spring is a competitor to JBoss (specifically, JBoss AS) is based purely on what I understand both products as providing: JBoss AS is (among other things) a managed container for EJBs, whereas Spring bills itself (by and large) as an alternative to EJBs. If your enterprise Java application is not using EJBs, your need for an application server like JBoss is diminished, and thus your need for JBoss’s services. Please forgive me if my limited understanding of the business world miscategorizes that as competition.
As for submitting code to projects like Hibernate: I’m on it. As mentioned, I’ve submitted code to Hibernate3, and Gavin ignored it. However, Emmanuel was far more polite and responsive, and I believe a patch of mine will be in the next version of Hibernate Annotations. Granted, this isn’t voluminous, overwhelming participation. But I’m making an effort, and I’ll continue to do so. Thanks for encouraging me on!
Lost in all of this was the fact that Keel Framework was also removed as a “Related Project” at the same time as Spring. I’ve never used Keel nor do I know much more than what’s on their site’s front page. But did they enrage Hibernate/JBoss in a similar manner?
What I do not understand about all this is that you do not have the time to “answer” all the forum comments, but do have the time here to spout this crap. Why do you not go back to bug fixing and enchancement. This is simply making you look foolish.
If you do feel as if some “comment” should be made, then release some to the public about it. Not in a forum where you are fighting like children.
The attitude alone is making me rethink using hibernate.
I use Spring, Hibernate, and JBoss, and I’m very impressed with all three products. I’m disappointed to read posts like Gavin’s above, because I disagree technically:
– Using HibernateTemplate (and OpenSessionInViewFilter) to access Hibernate from Spring web applications is a useful technique. It has no significant disadvantage. Unlike what Gavin suggests, it is portable between EJB2, EJB3, servlet containers, and even unit test harnesses. For people moving from Hibernate 2 (as I did), there is no compelling reason to rewrite their code.
– It’s clearly inappropriate for most people to switch to EJB3 at this point just to use Hibernate from a web application; especially if you might want to use application servers other than JBoss or Oracle (my client uses Sun for production systems, for example).
I don’t think JBoss and Hibernate are evil and I can understand their frustration. When they released Hibernate 3, they must have felt pretty pissed off to be told by some users they were sticking with Hibernate 2 because of Spring’s HibernateTemplate. Compared to Hibernate, it’s a very small piece of code. Compared to the value users get from Hibernate, or even the additional value of Hibernate 3 over Hibernate 2, the value we get from it is much lower. If it was a straight choice between HibernateTemplate and upgrading to Hibernate 3, I would have ditched HibernateTemplate, but I don’t have to make that choice, as it was ported within weeks.
JBoss and Hibernate have bravely invested a lot of effort in EJB3, which is a competitor to Spring in a very real sense. The method of connecting up components within an application is a fundamental architectural decision, and in the Java world we have a choice between EJB2, Spring, and now EJB3. Whichever technology wins that battle, has the high ground in influencing the rest of the application architecture. Spring’s simple approach, using a local configuration file rather than a global JNDI service, has been gaining a lot of ground on EJB2, despite not being a standard.
I guess JBoss and Hibernate must have thought that by contributing their excellent persistence technology, learning from the simplicity of Spring, and with the added cachet of being a standard, EJB3 would a dead-cert. Well, now it’s just about here, and I’m not sure it’s good enough to beat Spring. It’s more complex, more fussy about where it’s deployed (just JBoss and Oracle for the moment, compared to any servlet container for Spring), and it just doesn’t add much value beyond Spring – even the fact it’s a standard is not a practical advantage in my mind, given that a Spring application has no non-standard dependencies outside the application. There’s a possibility EJB3 could go the way of Entity Beans, and I suspect it’s that fear which is fuelling the hostility JBoss and Hibernate are expressing towards Spring.
Gavin,
You are clearly quite passionate in your dislike of the HibernateTemplate class. Could you explain why directly using the Hibernate API would be an improvement over using Spring’s HibernateTemplate? If there is a better way of using Hibernate within Spring, I would love to know it. To me, the Spring template class simply reduces the complexity of using Hibernate down to its bare minimum. How is that a bad thing? Does it lock me into using Spring? Perhaps, but I see no compelling reason to stop using Spring even after Java EE 5 is widely adopted.
What am I missing?
Bob
Why aren’t there any Hibernate committers who are not JBoss employees. Do the Hibernate people who don’t take the professional Opens Source deal have to walk the plank or something?
The next move from Spring would be to remove all references to Hibernate!
Denis Krukovsky
http://dotuseful.sourceforge.net/
http://dkrukovsky.blogspot.com/
I’m a Hibernate committer. I don’t work for JBoss. I use both Hibernate and Spring at work. Personally, I could care less about HibernateTemplate, and I don’t find it all that useful. This is perfectly fine with the Spring folks, thier attitude has been one of “use what you need”, which I really appreciate. Spring and Hibernate have saved my company so much time and money, that at this point I can almost afford to re-write everything with EJB3. 🙂
I have to give it to Gavin. After reading most of these posts I see he really does care what others feel about his product and that’s a good thing. One thing that does bother me is the indirect attack on Spring. Sure nobody from Hibernate may have directly said anything as crazy as “Spring-Framework sux potatoes!” However they have removed all references to Spring from their site and with the excuse of it being outdated. Why not replace it with updated references? Gavin has also admitted to having his opinion on Spring and the removal of all Spring related stuff from the Hibernate site shows this opinion more than anything. It akin to a racists declaring how much he doesn’t dislike a certain ethnic group. You can’t hide true feelings and somethimes the more you try to hide them the more they show on the surface. I have no malice towards Hibernate or Gavin or his team but I do wish that there wouldn’t be such a bias one way or another reflected in his products or on his site. Really, why not include references to Spring on the site? To remove them is to ignore a rather large (and growing) user base. Will there be plans to add features to Hibernate that will make it Spring incompatible? I know “there is no intention of doing so.” However I can see this happening under the guise of “Spring no longer wants to keep their product up to date with Hibernate evolution.” It’s real easy to blame the other person for your decision to exclude and barrier them out. It’s not so easy to admit a mistake, error in judgement, or over-zealous decision based on bias. I must say that up until I read Gavin’s responses on this Blog I really didn’t have an opinion on him one way or another. And while I respect him greatly for standing up for his product and his decisions I believe he really missed the point on this one. As a result he lost some cool points in my book.
I’m surprised no one has brought up the fantastic convenience of setting up the SessionFactory in the Spring configuration file! Surely even the most hardcore Hibernate fans have to admit it’s better to have that, along with TransactionProxies, than actually manually calling the Configuration code from Hibernate?
Hi,
Just some comment on why I personally don’t like Hibernate Template (and I have no connection with any of the projects, I am just an average joe developer).
I hate the Template because it enforces having only unchecked exceptions in its API. The end effect is usually that you end up with only unchecked exceptions being thrown from app persistence or DAO layer, and in my view exceptions like UserNotFoundException or DuplicateLoginException just have to be checked – and they are created in the persistence layer as a result of SQL statements usually.
Another point is that I have seen in my experience an app written by generally good but newbie to Hibernate developers, which suffered from bad Hibernate session management strategy and nested HibernateTemplate calls. The main factor behind this was of course lack of Hibernate experience, but the code looked ‘natural’ at the first sight. The conclusion for me is that Templates ‘invites’ newbies to mistakes like these, and is a kind of trap for them. 😉
I have personally developed quite big apps using hibernate (like 50KLOCs and more) and never had a need to use HibernateTemplate. The code was clean & maintainable, which has been proved in practice with 10 different devs joining the project and having no problems with the code in case of 1 project.
My $0.02.
Gavin,
I thought you used to be cool, but you really have started to become a A-class moron. Your post is completely off base. If people are finding good uses for the tandem, then leave it be or provide a *real* alternative.
You should of stuck with development instead of trying to become a (JBoss) marketer. Arrogance is better accepted there. Your company’s level of bashing will ultimately lead to its demise.
Regards,
Anti Gavin
To Gavin:
You said “I truly don’t get why the fact that we write software that lots of people find useful, give it away for free, and have a website which we sometimes make changes to makes people hate us so much that they have to write blog posts attacking us.”
Let me tell you why. The problem is not about your Hibernate product or your technical vision or skills. Your product is outstanding. It is all about the arrogance, sometime rude, of you and, probably, some other Hibernate team members. When people don’t like your personality, they will probably less like the good thing you do.
I talked to both you and Juergen on the forum. The impression that you gave me was really bad. When people point out something to you, actually they are trying to help you improve your product, no matter their opinions are right or wrong.
On the contrary, Juergen is a very nice person. I got this feeling not only from the response he gave me, but also from those he gave to other people. I think that’s one of the reasons why fewer people in this blog say a bad word to Spring.
Some suggestions to you: without a good personality, even you are the No. 1 in your area, you will gain much less respect than what you deserve. You can not make people like you by shouting at them, even you are their boss and pay them money, not to mention you are not.
Hibernate hates Spring
Ping Back来自:blog.csdn.net
There are definitely lots of hibernate commiters outside of JBoss.
+Ray
Gavin’s hubris is all the more phenomenal to anyone who’s had a look at the 2.x code. For him to criticize Spring is hilarious. Some of the worst shapeless slop I’ve ever seen. Gavin did accomplish something that eluded a multi-billion dollar cabal for a good decade, but he’s now teamed up with the institutional hubrians non pareil.
My feeling is that all these framework just work too well and that fighting over childish stuff is all is left to their creators.
I might be wrong tho
I am coming in here pretty much after most of this thread was written, but I want to correct some statements made by the JBoss guys:
Gavin>> think it’s a pretty clear matter of public record that the Spring and Hibernate teams fell out well over a year ago when Spring guys started publicly attacking our work on the JSR-220 spec. We have made several genuine private overtures to repair these differences, but apparently no-one on the Spring team is interested in being friends again.
No, it’s a clear matter of public record that JBoss people started bashing the value of Spring, including the Hibernate support, about a year ago. Comments like “Its like 10 lines of code. Why don’t you just write it yourself and contribute it back?” from Bill Burke in the thread mentioned earlier (and also in my post a bit farther) are very typical of the JBoss attittude towards Spring.
It’s absolute BS that we have attacked the JSR-220 spec. We’ve stated over and over that we are looking forward to supporting JSR-200 persistence (now to be called Java Persistence API), as soon as it appears relatively stable. This has always been the Spring approach; integrate with existing tools and try to add value, not replace them. Just last week at our NYC Spring Framework training I spent a day on the topic of data access (including transactons), and used Hibernate for the hands-on labs, while also mentioning a number of times that we will be supporting the Java Persistence API soon. How somebody can construe from this that we have something against Hibernate, JSR-220 persistence, or JBoss in general, is beyond me.
As for repairing differences, I think most unbiased third party observers would agree we’ve generally tried to be balanced, behave and get along with everybody else, while JBoss has been fairly agressive in attacking (at a minimum) various parts of Spring. There is not much, IMHO, in our behaviour that needs changing. As such, when JBoss comes along and asks us to join in their JEMS stack and we politely decline (what I believe Gavin is referring to), that has nothing to do with not being interested in repairing any differences, but 100% to do with us not thinking it makes sense on a product and/or economic basis.
Bill Burke>>> BTW, What really lit a fire under Hibernate to get rid of the need of Spring support was the following:
http://www.theserverside.com/news/thread.tss?thread_id=32172#159077
It is extremely annoying that the Springframework.COM had made such a big deal over such a trivial piece of code. THIS is what annoys JBoss. Stick to IoC and stop promoting simple trivial integration code and making Hibernate users believe they cannot live without it.
This is pretty funny. Even Gavin himself has said that Spring provided a decent amount of value with Hibernate 2.1 (as opposed to now, when he thinks it apparently provides no value at all). So we have one user here who on Feb. 28th says that he can’t switch to Hibernate 3 because he’s using Spring. But he was on Hibernate 2.1. Had he been using any other sort of library to make his life easier with Hibernate 2.1, he would have had to update that as well. In fact we had Hibernate 3 support in CVS about 10 days later. It would have happened even earlier were it not for the TSS symposium killing some time. There was already a user-submitted patch for over a month before that. We had an official Spring 1.2RC1 with Hibernate 3 support, one month later, on March 28th. All while Hibernate 3 was still in Beta. So I think we can hardly be accused of being tardy in integrating Hibernate or any other technology that is relevant to most of our users. These kinds of arguments provide a convenient basis on which to bash Spring, but the reality is that for the vast majority of Spring users, the Hibernate 3 integration came along well ahead of when they were actually needing it…
Colin
Galvin,
Majority of the developers love Spring. It’s saves us from tons of coding.
None of your points make any sense at all.
I can live without Hibernate, but life without Spring i can’t imagine.
There is no substitute for Spring. Learn to live with Spring.
I think you need to change the HibernateTemplate class to:
public class HibernateTemplate implements HostileIntegration …
It’s amazing. Everyone (and I mean everyone) don’t say a negative thing towards the developers of Spring (some people may not agree with Spring framework approach: note the word framework not developers). But people critize the hibernate developers directly. You would think the arrogance shown by the hibernate people would dilute over time because they get bagged everytime they open their mouths about Spring. Reminds me of a saying, “Cut off your nose spite the face”.
Dean
Gavin – “We so have a pretty deep difference of opinion (to the Spring Team)”
Like this one http://opensource2.atlassian.com/projects/hibernate/browse/HHH-472
This is typical, and I think I’ll side with the Spring guys. This is a Hibernate bug, not a Spring one as you suggest.
Gavin – “Certainly nobody “hates” anybody here.”
No-one cares about you emotion or motive, just your actions. Regarding the post above, either you are being unreasonably uncooperative (“maybe you hate Spring, maybe not”), or you are incapable of recognizing a serious flaw in your software. Certainly you are being uncooperative with the Spring Team.
Gavin – “Did we dishonestly or unfairly attack Spring anywhere?”
Yes. Want to re-post Christian Bauer’s version of http://www.hibernate.org/110.html (without clever censoring or editing)?
I’m not sure what you mean by dishonest, but that was a blatant, unfair and technically flawed attack – to place it on Juergen’s Spring integration page without consulting the Spring team was an extra insult – and you get upset about criticism on blogs. Without the link, there are still some quotes that give you the basic approach of that update:
http://www.logemann.org/blojsom/blog/default/2005/07/07/oops_JBoss_did_it_again_or_how_to_say_forget_Spring.html
http://forum.springframework.org/viewtopic.php?t=6877
Gavin – “In fact, did we even attack Spring at all, apart from removing some out-of-date information from our own website? No.”
Yes. Read above. The information was not out-of-date. Christian Bauer updated it (without consulting the Spring Team) with “anti-Spring” comments – no doubt that’s why he didn’t ask for feedback. Juergen then requested that it be removed. See:
http://www.logemann.org/blojsom/blog/default/2005/07/07/oops_JBoss_did_it_again_or_how_to_say_forget_Spring.html?page=comments
Juergen – “I hereby ask for immediate removal of my article “Data Access with the Spring Framework” (http://www.hibernate.org/110.html) from the Hibernate website.”
Gavin – “you obviously don’t like me and don’t trust the things I say”
Given the above, he has good reason not to trust what you say.
Gavin – “So how about *you* just ignore me”
How is that possible when you make such voluminous posts on other peoples sites.
Gavin – “…makes people hate us so much…”
Your perception – why is that? Maybe treatment of your own users like…
Gavin “..stinks to high heaven…your horrible data model”
http://opensource2.atlassian.com/projects/hibernate/browse/HHH-510
Gavin “these kinds of threads piss /us/ off”
http://forum.hibernate.org/viewtopic.php?t=927507#2187697
christian “Stop whining and explain your problem in a way that everyone can understand it”
http://forum.hibernate.org/viewtopic.php?t=931304#2203995
As you said, “nobody “hates” anybody here”. Just make sure your arguments are accurate and not abusive. I’d also recommend co-operating ethically with Spring, even if you don’t actively promote Spring. What does that mean? Not attacking or even editing an integration page without prior consultation to the page author or related project team. Not attributing Hibernate bugs to Spring.
Michael – “The end effect is usually that you end up with only unchecked exceptions being thrown from app persistence or DAO layer”
This is usually seen as “good” which is why many data access frameworks use an unchecked-exception strategy (e.g. TopLink, JDO, Hibernate3, Spring). If you want to wrap checked exceptions, you’d have to do so for these technologies as well.
“in my view exceptions like UserNotFoundException or DuplicateLoginException just have to be checked”
Regarding UserNotFoundException, just because an entry isn’t found is no reason to throw an exception – just don’t return any results. It may be applicable for some use cases but not for others – in that case handle the logic where it belongs, in the bsuiness layer.
Regarding DuplicateLoginException, this look like an exception that may be thrown by a service/business layer, not the DAO layer.
Gavin,
I’ve always been a great fan of Hibernate and admired your great work. But also I didn’t like some of the replies users got in your forum. I know there have been really stupid questions and there always will be.
But just bashing on these unexperienced users is just bad style. I guess a lot of these guys would have prefered not to get an answer at all.
And Gavin, you should try not react to other people’s opinions with good arguments, presented in a calm way. Hibernate is a very professional product, people are expecting you to be that, too.
Regards,
Lutz
(Hibernate-User since 1.x)
hey, i m concerned about using spring with jsf and hibernate. is spring the best choice or is their a better alternative.
what a seamless setup…
Instead of deprecating HibernateTemplate, please make it better. I m a fan of hibernate and before this issue happening, I haven’t considered Spring. I have just read a general info about Spring’s concept and attracted to explore Spring further. I thank you for all the time all of you spent in creating both frameworks. I really hope that both team will work together and benefit java community more instead of quarelling and compete with each other.
I for one welcome our new JBoss overlords
May I know the difference in Hibernate2 and Hibernate3 taking transaction management into consideration, Is there any improvement with Hibernate3
SESIONES EN HIBERNATE VS SESIONES SPRING
Embarcado en el desarrollo del servicio de workflow de OCAS y en su implementación con JBPM me he tropezado (de nuevo) con un iceberg: las sesiones de Hibernate y el cómodo/incómodo lazy loading. Existe en javahispano un estupendo artículo de Marti…
[…] Recently I blogged about the feud going on between Spring and JBoss. Today I got this (they are old but I missed them before) which further goes to show how deep is the fight between Spring and JBoss guys. Good lord the hibernate guys have taken down all the stuff related to Spring in their wiki. This fight among various open source projects do not bode well for the community in general. Competition is good; fighting and non co-operation is bad. […]
I’;ve decided that seeing as there is so much tension and anger on this blog I am donning the Microsoft shirt and moving to VB.net
No Spring, EJB or Hibernate there….Farewell cruel Java world.
P.S. Its Ok Gavin…we still love you!
[…] Anyway, in my thrice weekly trolling of JRoller, I came across Spring’s estrangement from Hibernate written by Rob Williams. It led me to mockhaug – Hibernate hates Spring which led me to [Marc Logemann – oops, JBoss did it again (or how to say “forget Spring”)]. […]
I shall request u all to stop this nonsense. Both have advantages and disadvantages. Instead of fault finding please cooperate. I belive whole heartedly that cooperation is the essence of the open source movement.
Regards,
Saurav
Saurav – “I shall request u all to stop this nonsense…Instead of fault finding please cooperate”
A fine intent, but it’s a valid and important topic. I think you should re-read the thread. Co-operation requires both sides to be involved. This thread clearly shows one side is being very un-cooperative. Be specific. Don’t try to drag one side into the mud that the other side is wallowing in.
Saurav – “Both have advantages and disadvantages”
That’s not the point of the article.
Both products are great and I couldn’t believe this blog exists, until now. Whenever I see a comment about Hibernate, I always see Hibernate developers defence Hibernate vigorously. Really, get over it and listen to what people say and take that as a suggestion.
What pisses me off with Hibernate is that whenever I ask a question in the Hibernate forums, I never get a helpful response, even with a simple question. There must be something wrong there.
You can say it’s free and so on but so do other projects, like Spring, Lucene and Struts? They’re always helpful I have a problem, even problem that is not related to their project. I thought that was what open source was all about, wasn’t it?
Re HibernateTemplate and UserNotFoundException, why not just returning null or empty collection?
>> What pisses me off with Hibernate is that whenever I ask a question in the Hibernate forums, I never get a helpful response, even with a simple question. There must be something wrong there.
I have to second this. I have *tried* to use the hibernate forum at least 3 times. Each time, I followed the question guidelines to a T. Each time, I got a flipant response or none at all. This has never happed to me in other forums.
This, on top of everything I read from Gavin, does not make it easy to keep an open mind about the hibernate team. It’s almost hard not to hate them.
Alas, they do have a great product. I will try to keep an open mind.
Personally, having come from other ORM solutions including a custom-built one back in the day when none existed, I can say Hibernate is the most feature rich and solid solution I’ve come across for ORM persistence. As for Spring, I love the injection pattern thing and I just learned about Spring Web Flow, a great multipage request solution. Since Spring doesn’t even do persistence and Hibernate doesn’t have a MVC framework or something for multipage requests like Web Flow, I fail to see why both shops seem to not get along so well. Apples and oranges. Keep the personal stuff out of the public eye guys! We love you both and the stuff you do!
However, the J2EE world keeps evolving and I personally am looking forward to EJB 3.0. After many years of stripping the old clog of EJB 2.1- out of apps designed by EJBvangelists and replacing them with ORM solutions (both commercial and open-source) and the DAO pattern. Finally, EJB 3.0 has grown and learned from it’s poor performing past (I believe the EJBvangelists and noobs are partly to blame for the mis-use of EJB in the first place… Remote interfaces remotely invoking code on the same server box… And all that unreadable code and classes… Ack!) and listened to what developers have been crying out for so long. I find it great that many features from many open-source projects (not just Hibernate and Spring) have been included in the STANDARD. I hope other ORM solutions become EJB 3.0 compliant so we have a nice proliferation of ORM solutions all inter-changeable, thus forcing projects to outperform each other rather than tying down users to a single API. EJB 3.0 is a good thing IMO. The nice thing about standards is that everyone is on the same playing field and the end users benefit from the interchangeable diversity. Finally, Java standards are evolving from fantastic tested and proven open-source technologies. JSF was the first true solution to do it and EJB 3.0 pushed the process further.
I believe both Spring and Hibernate folks should take a bow and a lesson in humility by accepting the compliment of having parts of their work being implemented into a coherent whole to be released as a J2EE standard and adopted by the Java community at large, in part or in whole.
On a final note, I personally believe that should Spring have an easy way to wrap the EntityManager and manage EJB 3.0 transactions the same way it does for old Hibernate and other ORM solutions, more people would be using Spring in CONJUCTION with EJB 3.0. I’m not talking about Hibernate here guys, I’m talking about EJB 3.0. Now that EJBs are POJOs, wouldn’t it be nice if I could build apps for my clients using Spring with another ORM or EJBs, but leaving the door open to switch from one or another? Anyway, that’s just my wish list for the next Spring… =) Time to play with all this new stuff!!!
Chris – “I fail to see why both shops seem to not get along so well”
AFAICT, the Spring team are perfectly happy to work with Hibernate. There’s no conflict for them in this. On the other hand, the Hibernate developers work for JBoss, and Spring takes away much of the JBoss value add – so they are actively trying to run down Spring – remember this thread started largely because Christian added his personnel negative opinion of Spring on the Spring integration page without consulting any of the Spring developers first. You have to ask yourself “Why?”…
I’d ask you to take look at some of the posts above and decide for yourself who’s not co-operating (e.g. http://opensource2.atlassian.com/projects/hibernate/browse/HHH-472).
Chris – “I believe both Spring and Hibernate folks should take a bow and a lesson in humility…”
I have never found the Spring team to be arrogant (or lacking in humility). I can’t say the same of the Hibernate team. Take a look at the respective forums. You’ll never find Spring team members telling their users to “stop whining” or that their data model “stinks to high heaven”.
Chris – “…by accepting the compliment of having parts of their work being implemented into a coherent whole to be released as a J2EE standard”
As noted above, I believe the Spring team are perfectly happy to integrate with Hibernate. I think directing such generic comments at both parties is a bit unfair.
I think Colin’s statement was fair enough – “I think most unbiased third party observers (who have followed the both projects and their interactions) would agree we’ve generally tried to be balanced, behave and get along with everybody else, while JBoss has been fairly agressive in attacking (at a minimum) various parts of Spring”. If you could have seen Chritian’s modified version of http://www.hibernate.org/110.html I think you’d agree.
I suggest both camps burry the hatchet and move on. Like any group of human beings, there will always be a few people on either side who enjoy a good barking match, to the detriment of both parties. I’m sure the majority of JBoss developers do not feel the outspoken few represent their entire group’s opinions, thoughts or feelings. Just as is the case with Spring.
Let’s move on guys. The open-source community was built on cooperation.
Guys,
Enough already. Pity us poor end users.
I have projects to get done. I’m told to use Hibernate3 and Spring. Thus I’m trying to figure out how. I’m reading conflicting instructions and I’ve got sample code that simply doesn’t work. After 2 weeks I still haven’t managed to get the SpringBlog sample program from the Pro Spring book to work.
It’s not like its easy to learn Spring and Hibernate at the same time while all the instructions are wrong.
Could someone just point me to a working web app sample that uses Spring and Hibernate3, and does transactions, and actually works?
In 10 above, Juergen says to see the refernce docs on ORM for a way that does not use the HibernateTemplate. Which docs? Where? Help!!!
Hibernate, Spring, both wonderful packages, both wonderful tools. However, your users are in pain and need help, guidance.
http://static.springframework.org/spring/docs/1.2.x/reference/orm.html#orm-hibernate
Specifically, sections 12.2.4 and 12.2.5 cover use of Hibernate in Spring w/o using HibernateTemplate.
As for working sample apps, there are a number of them in the standard spring distribution.
I haven’t read Pro Spring. But if you’re complaining about Spring’s lack of documentation, you clearly haven’t read the freely available, well written, and frequently updated Spring reference docs. Hibernate’s reference docs are quite thorough as well. I turn to those sources first when I have questions, and then to 3rd party books later to cover additional topics.
I’m reading, I’ve been reading.
I just haven’t managed to get anything to work yet. Including the examples that come with Spring. I pasted the xml files from the PetClinic demo into Eclipse with WTP and there were errors.
I downloaded the caveatemptor example, and it requires hibernate-annotations, which from their site doesn’t come in a form compatible with hibernate3, requiring instead 3.1beta.
The sample from ProSpring is where I have achieved my greatest success so far, but the logic here fails with a unique key exception, and that doesn’t make any sense to me as hibernate is supposed to take care of that on saveOrUpdate isn’t it?
public void save(Entry entry) {
Entry ex = new Entry();
ex.setEntryId(entry.getEntryId());
ex.setBody(entry.getBody());
ex.setEntryId(entry.getEntryId());
ex.setPostDate(entry.getPostDate());
ex.setSubject(entry.getSubject());
getHibernateTemplate().saveOrUpdate(ex);
}
I’ve been reading, downloading, searching, and fighting with code and examples for a month and a half now just to get one simple fully functional working example of spring and hibernate3.
Thanks for the link, I think I read that once, but I will again, and see if I can’t figure out where I went wrong last time.
Why are you copying over the Entry instance into a new Entry instance? Why not just persist the entry instance you pass in?
Hibernate will not protect against unique key exceptions if you manually assign identifiers yourself and you double up on them. Are you manually assigning id’s, or are you relying on a generator strategy (like ‘native’)? In your example, you’re copying over the entry id, which I’m assuming is the unique identifier for the entry. Typically, when persisting new entities, I rely on Hibernate to set the identifier; this could be the source of your unique constraint exceptions.
I don’t know what to tell you about not being able to get things working. For our project, we started out with just Spring, and introduced Hibernate later. We had few, if any, problems with the sample apps; our ‘applicationContext.xml’ still has remnants in it using one from a sample app 15 months ago.
I’ve never used it, but appfuse, written by Matt Raible, is a ‘starting app’ package that is supposed to help new projects get started using Spring and Hibernate (and a host of other projects).
http://appfuse.dev.java.net/
Equinox is a stripped-down version of this package, and may be a better starting point if you’re having so many problems.
http://equinox.dev.java.net/
I honestly don’t know. That’s the way the code was written in the Pro Spring book.
I’m just trying to sort through all the variations on how to do this that either don’t work, or conflict with something to end up with something that works.
Pheh,
12.2.4 eh??
I get to the first actual line of code:
Session session = getSession(getSessionFactory(), false);
and its wrong, there is no such method with that signature.
This is where us poor defenseless end users are loosing, and getting very frustrated. I just barely understand what I’m reading, and I’m trying to get one working example to build on. Your basic hello world program, and I can’t.
and it gets better.
The second line.
session.find()
Nope, that doesn’t exist either.
This isn’t exactly a help forum, John. I’m doing my best, but I think expressing your frustrations in this blog post is misplaced at best, and completely irrelevant to what this post was originally addressing. I’ve also found that the Spring developers in their forums are pretty good at answering questions about their framework.
However, since you’re not currently at the stage to recognize why you don’t need to make a copy of your object before persisting suggests you may be taking off bigger bites than you’re ready for. Simply copying-and-pasting code from books or online documentation that may be out-of-date with the version you’re using is a quick path to frustration, as you’re readily discovering.
And you’re hardly poor and defenseless. You have the full source code available to you, which provides both riches and power. A quick perusal of the source shows that
HibernateDaoSupport#getSession(boolean)
or
HibernateDaoSupport#getSession()
is probably what you want. As for session#find, I have no idea what that was pointing to. But Spring’s reference documentation isn’t the best place to find out how to use a Hibernate Session object.
Now we are getting to why I posted here.
I’m an end user, and I need to figure out how to get hibernate and spring to work together. I’m going to have to rely on you guys working together. The docs on hibernate.org about spring are all gone. The docs on springframework.com on how to use hibernate are all wrong.
I have quite happy managed to get either product to work all by themselves, but I need them together.
As for the bit about not needing to make a copy of the object before saving it, again, that’s how the documentation I found said to do it.
I thought it weird, so I did try the obvious one line version:
getHibernateTemplate().saveOrUpdate(entry);
Here’s the error:
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.apress.prospring.web.entry.EntryForm; nested exception is org.hibernate.MappingException: Unknown entity: com.apress.prospring.web.entry.EntryForm
Tell me where to go post, and I’ll post my questions there.
I’m not sure who you think you’re talking to. I’m not a Spring or Hibernate developer. Those guys are almost certainly not reading this post’s comments anymore; the original post was made almost 3 months ago. I’m just another end-user, like you. Unlike you, I’ve not had nearly the same amount of trouble getting our project to use Spring and Hibernate, and have been quite pleased with the level of documentation available, especially compared to most other open-source projects.
I’m sure, however, that you’re smart enough to find the website for both projects, and once there, find the public forums and mailing lists for each. You may also consider contacting the author of Pro Spring with your frustrations. Again, I’m sure you have the wherewithal to find his or her email address.
As to your particular problem, it now becomes clear (since you hadn’t actually stated in your previous post) that you’ve subclassed Entry as EntryForm. Hibernate cannot persist subclasses of mapped entities. That’s why (I’m assuming) Pro Spring’s sample code was making a copy of the object. I find this to be a bad pattern to get into, as it means every new property you add to your model object needs to also be reflected in your ‘save’ method. For our project, we tend not to subclass our mapped model objects (unless the subclasses themselves are also mapped), and instead rely on composition and delegates for our webtier forms.
Hmmm.
You are right. EntryForm is a subclass of Entry.
Weird, I would not have done that myself.
Yes, I am perfectly able to go visit the two projects web sites directly. However, in hunting around for examples, suggestions, even recommendations on the best practices of wiring them together led me here. And here I found someone at least willing to continue to point me in new and interesting directions.
On the web sites of the individual projects, I got dead ends.
Thanks
“Can’t we all just get along?”
I’m a developer working on a DoD project, using IBM Websphere, Spring, and Hibernate. I like most developers like using Spring WITH Hibernate because it reduces the pain of working with hibernate alone. I really don’t see why we are debating something that makes peoples lives easier.
Spring allows me to make one configuration change to switch between POJO’s or EJB’s in th web tier. This means I get faster development using POJO’s, and can switch to EJB’s for deployment. (Note: this project doesn’t need EJB’s, in fact they overcomplicate it. However, being a government project, I have to follow the mandate that EJB’s be used for data access.)
From my experience over the past 2 years it looks like Spring is very oriented to the pragmatic developer. Hibernate seems immersed in database theory. I’d never even heard of a “projection” before trying to get a recourd count. As for abstraction, both fail (not neccisarily a bad thing). You had better really know what’s going on in your database before using hibernate.
The documentation argument for Hibernate is loaded. “Hibernate in Action” spends 90% of the book talking about stuff that can be gleened from the java docs. The documentaion in the book and online for dealing with the hibernate configuration file is severely lacking. I often find the most painful part or hibernate is the damn configuration file. Of course, the same holds true for Spring (as anyone who has spent time looking for an error in a Spring config file can attest).
It seems dumb that these guys are fighting. Why should the Hibernate team give a *bleep* what the Spring team adds to their project? Maybe they should take a hard look at WHY they are and quit being so defensive.
hibernate solves a problem that isnt a problem….ditto spring…i have been doing j2ee for 7 years now, it has gotten so complicated/ridiculous, i quit….you guys stay here and flex your noodles, i am gonna switch to ruby on rails….while you are discussing all these “important” principles, i will be lying on the beach…..
Gavin:
[quote]This (credits) system is a roaring success, has been totally embraced by our userbase, and really has successfully fostered a true sense of community where users help each other out.[/quote]
Are you kidding me!?!? You are completely out of touch. People hate the credits system. All you have done is made the forum even more unbearable than it already was. There is absolutely no sense of ‘community’ by Hibernate users… with the exception of maybe a small group of ‘elite’ users. Your team’s attitude (most, not all) foster utter dread in asking for help or making comments. It’s unbelievable how clueless you are. Look around the internet at blogs such as this. Maybe instead of just fighting it, maybe you should actually listen to a few of them. You seem only capable of denial.
Url 参数的重复问题
前些天在公司做的一个东西涉及到了url重写,当时有这么一个问题,于是打算研究研究。
我要实现的一个功能是,把一个指向某个url的http请求,转到另一个url上,请求的url参数也要复制过去…
So can someone please give me a quick summation on why free software is so much better for the developer community than commercial product ? Looks just as twisted by politics and control freak management to me.
Hi all,
I have as yet to take the plunge into J2EE, EJB or much at all anything related to web application development. It is a challenge just trying to figure out where to start. So I am in no position to speak on anything technical as related to J2EE, EJB or the Hibernate/Spring thing.
However, after reading this Blog and its responses, it is unlikely I will ever consider the use of Hibernate or Spring when I do finally take the plunge into J2EE. What interest I had in either of these frameworks has all but disappeared.
UnReal,
Phil
So Gavin, please make it clear – Is the future of Hibernate a framework or a JBoss extension ?
哈哈 ~~~大家讨论什么这么热闹!
Spring的前途到底会怎么样啊?!
期待ing….
[…] hibernate spring) No Comments so far Leave a comment RSS feed for comments on this post. TrackBack URI Leave a comment Line and paragraph breaks automatic, e-mail address never displayed, HTMLallowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> […]
[…] No, this isn’t another post about my 2nd favorite Java project. […]
JBoss Group Inc. OWNS Hibernate….not the developers!
How much stock did Gavin get from JBoss for selling his soul and Hibernate? And if Oracle buys JBoss for $200 Million as was rumored, how much money will Gavin end up with?
So, yes, of course Hibernate is a JBoss-centric tool. There is too much money at stake to be anything else. And the elminiating of support for Spring under the guise of something stupid as a bad integration sure sounds like the b.s. it is. Especially when Spring competes with JBoss app server by not requiring EJB3 to do persistence. Hip Hip Hooray for POJO. This is a direct result of who owns and controls Hibernate.
As I always say, just follow the money and the stink will surely come to the surface. What an amazing irony, Gavin starts out from sheer arrogance and lack of experience pushing Hibernate for free, only to find out later that he could not dismiss the reality of having to pay his bills. So, he develops a free tool that will require CONsulting services…we used to call tools like that CONsultingware (beware of these as they ruin your budget). And he has to sell out to Marc Fleury / JBoss Group Inc. to pay his bills.
Please don’t get caught as many of my friends have by using Hibernate for completely inappropriate projects and receiving the fallout from management over the lost time and hassles. Hibernate is good for some apps but not all apps. Please take the time to investigate if Hibernate meets your needs before getting dazzled by the hype of open source and the arrogance of Gavin.
[…] After a long time, it was interesting to see the Spring and JBoss engage in a public war of words again, in comments on Matt Raible’s blog. […]
Phil – “after reading this Blog and its responses, it is unlikely I will ever consider the use of Hibernate or Spring when I do finally take the plunge into J2EE. What interest I had in either of these frameworks has all but disappeared.”
I think you’ll find these used almost everywhere, with good reason and good success. All I can say is DON’T BE PUT OFF. They are both great tools, and you’ll be the poorer for not using them (in fact I’d reckon you can’t). Take the time to make a technical judgement. I wouldn’t base such a decision on an isolated blog.
Man this is classic XD
THE BEST thread EVER!!!
GAVIN has taken it to another whole new LEVEL!!!
Personally I like hibernate and have huge respect for Gavin’s work.
However after time and again reading Gavin’s often overly assertive, egoistic and long replies that condemn everyone not on his side to moronic status…..justified or not …. I can only conclude that he is an asshole…. I still respect his work …. but personality wise he is a total wreck …. well I can’t judge cos I don’t know him personally, but thats the impression he’s giving a lot of people….(remember JDO? I think Gavin have a point…but the way he did spoke out against them just plain SUCK)
great … now the main people who created my 2 favourite frameworks are not on talking terms. This absolutely sucks.
My post is childish …. so is Gavin who started this and the Spring guys who actually replied knowing how its not going to help.
ALL THIS PLAINLY SUCK ….. PLAIN SUCK. REALLY DISILLUSIONING…
i am just learning spring & hibernate. in the beginning i really feel that spring & hibernate are just so wonderful. i was trapped with the promise of how spring and hibernate can simplified the development of web application. the fact that i stumble into this blog proved me that trying to use both frameworks have caused chaoz.
i hate to be foced to use JBoss product. this is not the spirit of Java development at all. For Gavin, your attitude is very much like Microsoft approach to restrict me in developing a product in one platform. It’s really a dissappointment attitude!
Hibernate is really overrated. I spent a few weeks prototyping Hibernate and Ibatis as persistence for a web app, and Hibernate causes more issues and is more difficult to configure than Ibatis. Stop drinking the Hibernate kool-aid guys. The hibernate/jboss guys done a good job selling it that’s all. Its a full-featured, deep product, but it also introduces new issues that require what i consider kludges to workaround.
Its a good cool ORM but there’s other ways to do db persistence, other ways more practical, easier, that give you better control and transparency (Ibatis), so you dont have to do nasty hacks to workaround.
Thanks to both the hibernate + jboss + spring teams for putting nice products out there to make my life easier.
Perhaps these teams are in some competition now but still
a lot better than the alternative ( think ejb 2 ).
Also both spring and hibernate have had a profound effect on
the community , fostering a great deal of innovation.
I say thanks and great work guys !
“Oh you “know” this. So, do you have a single example of “jboss people” putting alpha code into production? I have never seen or heard of such a thing. ”
Just to show you a few examples:
1. Jboss AS 4.0.3 STABLE release contained some “RELEASE CANDIDATE” of hibernate 3.
2. Jboss AS 4.0.3 STABLE and some earlier versions contain broken JDBC3 JMS persistence manager. We are not the only company that lost money due to this. Even Jboss folks know this, as they warn users against using it on their wiki. But there isn’t a slight warning in the docs/specification!!! This broken manager was fortunately removed in the latest release of AS 4.0.4.
3. Jboss AS 4.0.2. STABLE had some serious issues with memory leaks.
4. Jboss AS cannot reconnect to database in case of temporary db backend failure. The reconnection module is still in alpha…
5. Jboss AS 4.0.3 doesn’t work correctly on FC3, AMD 64 bit, while the same configuration worked on FC3, AMD 386 compatible mode. We couldn’t figure out what caused the bug, but we received also no help from the Jboss community. Ok, it’s not their fault, we should have bought commercial support 😉
All these problem stated above make us we don’t trust Jboss any more, and we make all new projects using lightweight containers. Hibernate itself is ok, though some design decisions are very unclear to us.
Due to the deliberate lack of locking or any advanced concurrency control it is not possible to get a mission-critical system that uses both Hibernate, transactional database and transactional cache (the only supported transactional one is: Jboss Tree Cache). Try setting the transaction isolation level to SERIALIZABLE both in the backend and the cache – it simply doesn’t work. Undetected deadlocks would kill the application responsivity… This is not the way you should build an enterprise HA system.
If Gavin’s perception of Spring is that it is some kind of Borg like entity slowly integrating the universe, his attacks actually make some sense.
“Resistence is futile, your technologies uniqueness will be added to our own…have a nice day”
Faced with a perception like that, I’d be running for the hills screaming. However, for your average Java developers, we just see them as eggs and bacon; they go great together:)
> I truly don’t get why the fact that we write software that >lots of people find useful, give it away for free, and have a >website which we sometimes make changes to makes people hate >us so much that they have to write blog posts attacking us.
you don’t get it ?
of course you would give it away free, sinc its the first step of this “time-transactionaly” driven goal of vendor-locking users over time, giving away free ,and promoting a Jboss behind the scenes at the same time? I am sure jboss would pay anough for that promotion to make up the cost of “free software giveaway” .
Giving it away for free, so later on more and more users potencialy get to lock into JBoss,wow quite a strategy!!!, I don’t beleive in that kind of free software, its same as free samples of tooth pase …
It’s clearly visible, the only reason you are mad at sprint templates because it jepordizes that ultimate goal of ….????? hhhhmmmm makes you think haa?
HI,
Visit: http://www.roseindia.net/struts/hibernate-spring/index.shtml.
This tutorial shows how to develop User Registration and Login Application using these technologies.
Regards
Deepak Kumar
Hi,
Do you want to Learn Struts, Hibernate and Spring to develop robust enterprise application.
Visit: http://www.roseindia.net/struts/hibernate-spring/index.shtml
This tutorial shows how to develop User Registration and Login Application using these technologies.
Free running source code is also provided. You can download the source code for free and run the example easily.
You can use this application as a base of further developement of your application.
Regards
Deepak Kumar
Who would win a bare knuckle street fight, Rod Johnson or Gavin King?
I think Gavin King will win in a street fight
I’m working in the same project (25 programmers) for about 2 years now. It’s a HUGE web project. Everything has been done with Hibernate 3.0 / Spring 1.*. After this experience I’ve got something to say: Hibernate sucks. It is not flexible and good enough for bigger project.
Worst: the hibernate 3,2 it is not fully compatible with 3.0, you have to migrate a the queries to do so. In a project like ours, it is simply unthinkable.
I heard that if you want to migrate to Spring 2.*, you also need some ‘adaptation’. What’s wrong with you guys? You think that everything is a joke?
Bottomline: Pure JDBC with plain EJB do the job just fine…
I’m working in the same project (25 programmers) for about 2 years now. It’s a HUGE web project. Everything has been done with Hibernate 3.0 / Spring 1.*. After this experience I’ve got something to say: Hibernate sucks. It is not flexible and good enough for bigger project. The list of bugs is only growing.
Worst: the hibernate 3.2, it is not fully compatible with 3.0, you have to modify the queries to do the migration. In a project like ours, it is simply unthinkable.
I heard that if you want to migrate to Spring 2.*, you also need some ‘adaptation’. What’s wrong with you guys? You think that everything is a joke?
Bottomline: Pure JDBC with plain EJB do the job just fine…
[…] The height of the friction between the two camps was perhaps best captured in a blog post from last year by Scott Haug, a developer at Jobster, entitled “Hibernate Hates Spring.” […]
Gavin, your product is really great, but your personallity makes you a complete asshole, it’s a shame that some brilliant people think that they are better people just because they can do brilliant things. To be thankfull and to respect others is what makes someone a great person. Hope this message doesn’t bothers you, just be cool with people and people will love you as they love your work.
Gavin must be the biggest asshole on earth. My favorite quotation of his is: “If you absolutely insist on this shitty Joshua Block defensive coding style (which is only useful for people who don’t write unit tests)”. Who does he think he is?
[…] classes are intrusive and offer no advantage over using for example the Hibernate API directly [9]. In response the Spring developers have made it possible to directly use the Hibernate and JPA […]
If Spring and Hibernate were my children, I’d make them stand in the kitchen with their noses touching for ten minutes, then hug and tell each other “I love you.”
After several years, I searched this thread again and I think what Gavin said is true. I used Seam, EJB3 and JSF. Its a WOW. keep up the good work!