I would like to know how much does the database matters when using Hibernate framework. There is a huge difference in standalone databases when comparing for example Oracle and MySql, but I can't see a big difference when database is hidden behind Hibernate. What would me advant开发者_如何转开发ages of using Hibernate in conjunction with more advanced database systems?
Thank you for answers.
Hibernate is more or less a mapping language that lets you call Hibernate methods in your code, and have the Hibernate library convert these method calls into the appropriate JDBC calls (more or less).
So, as long as Hibernate knows how to convert its API calls into the correct, efficient SQL for a given RDBMS, it shouldn't matter. The "maturity" of the RDBMS may be an issue if it keeps changing features, etc. - but only in the sense that the corresponding Hibernate dialect would need to be continuously updated to deal with that particular version.
In most case, if you're just using aspects that conform to the SQL standard, you shouldn't see a problem with Hibernate as it should be able to handle lowest-common-denominator stuff just fine. That said, if you're using this RDBMS spceifically for its "more advanced" features, you may be disappointed that Hibernate doesn't take advantage of them (depending on whether the cool features are entirely internal, such as a very performant query optimizer, or are external such as some new SQL commands).
Hibernate is just a tool to make your interaction with db easier than simple jdbc. But hibernate won't do the db work for it: it can't improve the db performance or add some features to it. So database is still an important choice to make.
Besides the intrinsics of the RDBMS, the difference lies in the capabilities of the specific "dialect" that will be used as a consequence.
I can say with authority that it can matter very much. I'm not sure if you will see much difference at an application level between MySQL and Oracle but if you go "down" the DBMS list and get to databases such as SQLite or H2, their internal workings make a lot of difference depending on the types of objects you store and the access patterns you make -- even with hibernate hiding the database eccentricities. The particulars around the locking mechanisms, concurrency abilities, how they handle transactions, index building/utilization/interaction, etc. will impact how well your application will function -- sometimes significantly. For example, we had to migrate gigabytes of data on a running system from H2 to MySQL because of limitations that we uncovered -- even though we use hibernate everywhere.
Obviously, also, each database has its own feature set wrt replication, sharding, overall performance, cost, admin tools, etc. that must also be taken into account.
精彩评论