Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When should I use JDBC and when to use Hibernate

 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like I have 4 choices of technology of database access in Java:

1. Hibernate
2. JDBC
3. Entity Beans
4. Ensity Bean container

It seems like Hibernate is the right answer. Do you agree?

-- Kaydell
[ November 25, 2006: Message edited by: Kaydell Leavitt ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kaydell,
It depends on your requirements. There are almost never absolutes about always using a given technology. For example, if you were doing a single complex query, Hibernate would be overkill.
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't seem to figure out how to implement UTF-16 CHARS using JDBC.

Does Hibernate serialize objects and then allow the resulting data to be stored in a JDBC database?

I worry about serializations that are stored on a disk or that may become different between client and server such as might be the case when using RMI. Is serialization a problem and does Hibernate use it to map objects into a relational database?

-- Kaydell
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kaydell,
Since this wound up being more about Hibernate than JDBC, I'm going to move the thread to our O/R forum. They know more about Hibernate and can give you the specifics.
 
pascal betz
Ranch Hand
Posts: 547
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm. why is my response here ? was intended for another post.

pascal
[ November 27, 2006: Message edited by: pascal betz ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDBC is good for quick-and-dirty, but ORM is generally preferable for larger, more complex projects. Interestingly enough, even though the ORM projects normally are using JDBC as their underlying access method, benchmarks indicate that they tend to be more efficient than raw JDBC. Like assembly languages vs. HLLs. It may sound paradoxical, but I've seen more than my share of horribly inefficient assembly algorithms used simply because writing a smarter one takes too long.

No, Hibernate isn't using serialization, BTW. It's using JDBC. Part of the Hibernate functionality is to establish a mapping between data objects and SQL objects in the backing database, generate the SQL code needed to access and modify it, and manage the execution of that process.

Just to repeat something I said the other day, however, do try and minimize the number of programs modifying the database at the same time. If only one app changes the data, there's never any question which app is misbehaving.
 
pascal betz
Ranch Hand
Posts: 547
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see my post above. something went wrong here.
Pascal
[ November 27, 2006: Message edited by: pascal betz ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDBC is good for quick-and-dirty, but ORM is generally preferable for larger, more complex projects. Interestingly enough, even though the ORM projects normally are using JDBC as their underlying access method, benchmarks indicate that they tend to be more efficient than raw JDBC. Like assembly languages vs. HLLs. It may sound paradoxical, but I've seen more than my share of horribly inefficient assembly algorithms used simply because writing a smarter one takes too long.

No, Hibernate isn't using serialization, BTW. It's using JDBC. Part of the Hibernate functionality is to establish a mapping between data objects and SQL objects in the backing database, generate the SQL code needed to access and modify it, and manage the execution of that process.

Just to repeat something I said the other day, however, do try and minimize the number of programs modifying the database at the same time. If only one app changes the data, there's never any question which app is misbehaving.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic