• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

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

 
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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"

 
Gian Franco
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I answered this question here: https://coderanch.com/t/214937/ORM/java/Bauer-King-Hibernate-formulating-queries
 
author
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could I use hibernate to persist data in non -relational datastore like OODBMS or flat file? :roll:
 
Gavin King
author
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope, definitely not!

(Why would you want to?)
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic