Congratulations and you're probably having a fair bit of fun coming over. Spring is great fun if you're building web apps; the first and best point of it is, a convenient and maintainable way to hook up and configure all the different parts of your app.
Business services, http request controllers, db access, mail senders, product catalogs, app data... all the config can be done bean-style and easily maintained... all the inter-object references can be set by Spring...
Thus eliminating the need for setup constructors, passing refs from here to there, push- and pull- updating, order-of-init problems, a whole couple of categories of code whose only logical function was to be a place bugs could exist, gone in one fell swoop.
First off, the vast array of choices is staggering and I'm completely unsure where to go from here. I have been using JDBC and "mapping" my own objects manually but we all know how un-maintainable that is.
Well, we all know that it's a fair bit more maintainable than scattering JDBC code everywhere. But a proper O/R engine will give you field mapping performance *and* enable you to run different access patterns/ queries etc across these, to fetch your app data.
Anyhow, here are my questions and assumptions, please answer/correct me where necessary? I'm not looking for a flame-war and a bunch of sales pitches based on everyone's favorite technologies. What I really need is a seriously objective look at what I'm asking, please!
JDO is cool, Hibernate is cool, which one you might use depends on what level of project you're doing and whether you want to go standard or not.
Personally I like proper support for JOINs and UNIONs -- and I've been suprised to find the number of different impls which will map a union but execute it is as repeated non-unioned queries. ?
Proper support for unions, and certain column/ data types, needs control down to individual column specs. Most data of course is happy with default, but I like tools which can actually deal properly with the database structures that are out there.
How efficient is Hibernate vs. using, say, stored procedures and a DAO/JDBC framework? I know many programmers answer questions like this emotionally and entirely based on preference, damn the consequences. Again, objectivity please. I'm actually quite skilled with RDBMS (sql server, firebird, others...) and am a fan of stored procedures, used apprpriately and if there is a benefit to using them.
One of the advantages of JDO is that it uses compiled data access and keeps 'pure' object identities. HB uses reflection and proxies quite a lot and these impose some amount of overhead. Probably ok for smaller apps though.
Do Hibernate and JDO overlap entirely or are there differences? Which is better?
Ahem, by better I mean, which is the most proven and highly-used, highly-acclaimed of the two? Which is the most *simple* to work with?
JDO is a Java standard and gives you some degree of pluggability between vendors. New JDO2 query technology can also bring some advanced performance capabilities. HB is obviously free and has a loyal fan base.
6. Is there a way to auto-generate the descriptor files for my objects based on my database schema w/ either JDO or Hibernate? Can this be done within NetBeans? (Open Source or Freeware only!)
Commercial impls have Reverse Engineering and UI tools with various degrees of sophistication. Freeware typically doesn't get to that standard.
As for IDEs, I mainly do Java and web coding, but damn if Eclipse ain't it. Perceptually about 3x faster and a whole lot slicker. IBM engineers nailed this one, hard.
You'll also want to check out Ant. At some stage you'll want to start building/ deploying libraries, apps or other production artifacts. After you've jarred or copied filesets manually a few times, you can setup Ant to do this for you. Not just the convenience, but it will do it reliably.
Ant tip: clean by moving files to a 'deleted' bin, rather than deleting directly. Your buildfile will likely have errors until you've tested it, and I've had deletes go off in my project root folders... :-( :-( :-(
Doesn't having to update descriptor xml files and business objects *sort of* cancel out many of the benefits of O/R mapping?
Well, except I can template up a getter/ setter class, add it as JDO, Forward Engineer it to a table, clean up a few fields/ mappings and add a row to the key allocator table -- in about 8 minutes.
Versus 2 or more hours.
Will EJB 3.0 blow the competition out of the water? I have read only small bits about it but it looks promising. I haven't bothered to learn much about EJB in its current state as I am advised not to around every turn!
Well, forgive my cynicism but it would *have* to look promising at this point. But the success stories I'm hearing these days are multi-headed Tomcat with JDO or HB for storage.
EJB3 of course is being hyped and that's not just J2EE but a 'new' persistence spec, the big box vendors were probably starting to feel left behind, this persistence spec will also be usable outside J2EE so that's what most of the hype is about.
Does Spring overlap with JDO and Hibernate? Spring seems like a jack-of-all-trades and I'm unsure how it would be useful to me, exactly.
You won't even have to code constructors since Java defaults a no-arg one if no others are specd. Nor init code. All your init becomes XML and you can see and edit it in the one place.
I know I may be asking some fairly simple questions but believe me, I've been researching the topic for a few weeks now and am ready to being using one of these technologies in future projects, some small business open source apps I'd like to release next year, if possible.
Interesting. Web interface or client/ server? Half of Spring's usefulness is the Web MVC stuff. Solving the config- and init-code problem is a pretty good bonus for any app, though. I think Spring can be be used in many parts, and would entirely be usable for this - but to be honest web is what I'm using it for.
If anyone can show me some SIMPLE code examples of Hibernate performing some of the common tasks you would normally use SQL for, I'd REALLY appreciate it. I found their documentation to be rather complicated, at first glance, and haven't had much luck finding straight-up, simple code to demonstrate.
Certain people have been prone to spitting the dummy at other apis, despite nothing being perfect and hb having some distinct technical tripups.
But what you might be seeing that could confuse you, are chained invocations -- these are quite a useful feature where methods that could have been declared to return void, actually return the object you called them on. This allows you to conveniently call several modifiers or methods in a chain.
Thomas Whitmore www.powermapjdo.com