views:

947

answers:

4

Just trying to get my head round Spring and figuring out how I wire up an Oracle connection in xml config file, and now find out I need yet another framework! - Hibernate, this is soooo frustrating as it feels like I'm getting deeper and deeper into more and more frameworks without actually getting what I need done!

I looked at Hibernate and it seems to do similar things to Spring, bearing in mind I just want to do some SQL inserts in Oracle.

I am reluctant and do not have time to learn 2 frameworks - could I get away with just adopting Hibernate for the simple things I need to do?

+6  A: 
OscarRyz
+2  A: 

Hi,

Spring and Hibernate are totally different frameworks for different problems. Spring is a huge framework with many many features, Hibernate is an O/R bridge.

I would recommend using plain old JDBC in your case ('just some SQL inserts in Oracle').

André Boonzaaijer
Spring has ORM too.
OscarRyz
Yes, the only thing Spring doesn't have is its own VM, which will probably be added soon won't it? ;)
André Boonzaaijer
The funny thing is that Spring is said to be lightweight, even though it is such a large framework. Apparently lightweightness is relative - in Spring's case lighter than a full Java EE application server.
Esko Luontola
It's never just a few SQL inserts into Oracle. Ever. *SIGH* Hibernate gives you expandability options.
Jim Barrows
@Esko, Spring is said to be lightweight because using one component does not force you to use others, often your code doesn't have much of a dependency on Spring; the weight of what Spring forces onto you is very light
matt b
+2  A: 

Spring and Hibernate are really intended to do two different things. Spring is first and foremost an inversion-of-control container and configuration subsystem, while Hibernate is a database binding and lazy loading engine. If you don't want to introduce a bunch of new stuff into your code, stick with Spring and roll your own queries or use iBatis to do much simpler database binding.

Jeffrey Hantin
Don't confuse him with iBatis, IMHO. Its indeed a good framework, but yet another for him. No negatives for sure.
Adeel Ansari
+5  A: 

You could get away with using just spring and spring-JDBC integration. Depending on the complexity of your data-access needs it may be more than enough. The spring Object-relation mapping is also worth looking into if you're going to do a lot of data-access.

The nice thing about spring is that it's a very loosely coupled framework. So you can read up on the bits you use, and forget the rest - even in the runtime.

krosenvold