aspose file tools*
The moose likes Object Relational Mapping and the fly likes Q 4 C. Bauer & G. King (3): Hibernate = Strict OO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Q 4 C. Bauer & G. King (3): Hibernate = Strict OO" Watch "Q 4 C. Bauer & G. King (3): Hibernate = Strict OO" New topic
Author

Q 4 C. Bauer & G. King (3): Hibernate = Strict OO

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Dear authors,

Does Hibernate 'impose' a strict
object oriented view of the
database? I mean, can't I just
peek into a database table in
the old fashioned way but using
Hibernate?

Cheers,

Gian Franco Casula


"Eppur si muove!"
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Is your question asking about Hibernate allowing to use normal SQL statements?
If yes, than the answer is yes too. Hibernate Session offers the means to execute normal SQL querying.


blog - InfoQ.com
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Gian Franco Casula:
Does Hibernate 'impose' a strict
object oriented view of the
database? I mean, can't I just
peek into a database table in
the old fashioned way but using
Hibernate?

Hi Gian,
If you just peek into a databse table, you can't apply the OO Concept from your peeking... By using Hibernate, you can get advantages of OO from it, which are mapped to the ralational database... For instance, reusability, inheritence and so on...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Ali Pope:
Is your question asking about Hibernate allowing to use normal SQL statements?
If yes, than the answer is yes too. Hibernate Session offers the means to execute normal SQL querying.


In hibernate use MUST USE "Hibernate Query Language[HQL]"


Hibernate Query Language[HQL] designed as a "minimal" object-oriented extension to SQL, provides an elegant bridge between the object and relational worlds"


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Somkiat,

My understanding is that you can use HQL, but
can use vendor SQL as well.

I guess this is done in order to allow programmers
to use a vendor's SQL peculiarities if necessary.

Cheers,

Gian Franco Casula
Christian Bauer
author
Ranch Hand

Joined: Aug 31, 2004
Posts: 45
I answered this question here: http://www.coderanch.com/t/214937/ORM/java/Bauer-King-Hibernate-formulating-queries


Co-Author of <a href="http://www.manning.com/bauer" target="_blank" rel="nofollow">Hibernate in Action</a>
Gavin King
author
Ranch Hand

Joined: Aug 31, 2004
Posts: 76
I like to say that Hibernate unifies relational querying with object modelling.

So no, it is not "strict" OO in the sense that it has no concepts from outside the OO mindset. Hopefully, Hibernate helps you think about your data in both ways, by easing the conceptual gap between the two models.


Co-Author of <a href="http://www.amazon.com/exec/obidos/ASIN/193239415X/ref=jranch-20" target="_blank" rel="nofollow">Hibernate in Action</a>
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Could I use hibernate to persist data in non -relational datastore like OODBMS or flat file? :roll:


Groovy
Gavin King
author
Ranch Hand

Joined: Aug 31, 2004
Posts: 76
Nope, definitely not!

(Why would you want to?)
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Pradeep Bhat:
Could I use hibernate to persist data in non -relational datastore like OODBMS or flat file? :roll:


Hibernate Support Database


Hibernate requires JDK 1.2 or later (some people have run successfully under 1.1.8) and has been tested with the following SQL databases:

DB2 7.1, 7.2, 8.1
MySQL 3.23, 4.0
PostgreSQL 7.1.2, 7.2, 7.3, 7.4
Oracle 8i, 9i
Sybase 12.5 (JConnect 5.5)
Daffodil DBv3.1
Interbase 6.0.1 (Open Source) with Firebird InterClient 2.01
HypersonicSQL 1.61, 1.7.0
Microsoft SQL Server 2000
Mckoi SQL 0.93
Data Replication Tool
Progress 9
Pointbase Embedded 4.3
SAP DB 7.3

Hibernate is also thought to be compatible with the latest versions of:

Informix
Ingres
FrontBase
Firebird (1.5 with JayBird 1.01)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Gavin King:
Nope, definitely not!

(Why would you want to?)


For e.g. my application reads/updates data from two datastores. First one is RDBMS and 2nd one is some legacy system. I was thinking if Hibernate could be used in both cases? :roll:
Thanks Gavin.
Gavin King
author
Ranch Hand

Joined: Aug 31, 2004
Posts: 76
No, we can't talk to legacy data, unless there is a SQL layer over the top (which is the case, in some cases).
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Pradeep Bhat:


For e.g. my application reads/updates data from two datastores. First one is RDBMS and 2nd one is some legacy system. I was thinking if Hibernate could be used in both cases? :roll:
Thanks Gavin.



No, you can not do it.

BUT you can use DAO or EIS system to solve this problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Q 4 C. Bauer & G. King (3): Hibernate = Strict OO