Forums Register Login

Is Hibernate is DB dependent or Independent?

+Pie Number of slices to send: Send
Hi,

Hibernate supports lot of databases. My Question is

1. Is Hibernate Works in all databases
2. And How this Hibernate Works for multiple database

for eg. in oracle integer data type is integer/number
and in mysql integer data type is int

Pls give me the explanation

Thanks
edward
+Pie Number of slices to send: Send
 


1. Is Hibernate Works in all databases


No. But it works with all the big name databases. Have a read of the supported databases on the hibernate site.



2. And How this Hibernate Works for multiple database


Hibernate will work with a whole host of databases without any code changes, with the caveat that you don't implement any database specific stuff in your data access code, such as vendor-specific SQL, using the database to generate primary keys, calls to Stored Procedures etc. It does this by using a Dialect to talk to the database. All data manipulation happens to the object (often refered to as the Plain Old Java Object, or POJO), and Hibernate implements these changes to the data in the database by way of the Dialect. You just tell Hibernate (by way of a configuration file) which database you will be using and it handles all the details.
+Pie Number of slices to send: Send
 

with the caveat that you don't implement any database specific stuff in your data access code, such as vendor-specific SQL, using the database to generate primary keys, calls to Stored Procedures etc.



Yes, that is true, but don't think of it harshly. You can still use all these to boost your perfomance to your situation, and you can have all these "changes" in your XML, so that if you did change the database, you wouldn't have to change your code, but your Config and Mappings. Except when you do vendor-specific SQL using SQLQuery in your code, but there is a way to put vendor-specific SQL either as a named query, or if you want some in the Select portion of the SQL, then you can use a "Formula" property and put in the SQL for that part. Sorry going to far here.

Mark
It runs on an internal combustion engine. This ad does not:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1579 times.
Similar Threads
generics "uses unchecked or unsafe operations" problem
Hibernate vs Legacy DataBases
Java and PL/SQL
Hibernate pagination
how to use 2 database in hibrnates.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:24:02.