What is the main advantage of using the hibernate than using the sql

Showing Answers 1 - 35 of 35 Answers

siddharth

  • Oct 25th, 2006
 

main advantage is that it avoids writing querries.ofcourse, u have to write to some extent but alot is relaxed.most of the work is taken care by mapping.also criteria class is very useful for complex joins.

ramarao g.v

  • Nov 3rd, 2006
 

The main advantage is ..using ORM we can avoid the jdbc API completely and also provides ease to the developer in developing the classes.

Sony V George

  • Apr 5th, 2007
 

It will give more performnce than SQL Written Query. But it doesnt means that it will reaplced by hibernate.

When and how the hiberate tool is selecting is an important role. One who not strong in SQL Select hibernate to avoid SQl is not good practise. First of all we need basic knowlegde of SQL and its working.

Other wise he would fail to understand the process happening on the underneath , it will cause performance issues and make rework also.

  Was this answer useful?  Yes

brett

  • Apr 17th, 2007
 

Easily migrate your code between different databases. Good for updating, maintainning your application.

  Was this answer useful?  Yes

Guest

  • Apr 25th, 2007
 

The main advantage of using hibernate is there reduces writing huge code .
Actually hibernate developers developed for easy use not to write huge code.
Here there is no need to write the jdbc code here we will use the connection pooling technique and it happens internally and because of connection pooling we can reuse the connection from the pool.
 And the relationship will be between names of the properties and the names of the columns and the names of classes to names of tables.

Vishal Mehra

  • May 12th, 2007
 

I think there is one big advantage of hibernate, that is you can make Database independent application. As we have to work on POJO class for interacting with the database, so its basically reduce dependency on JDBC. 

Thanks
Vishal Mehra 

abiswal

  • Aug 31st, 2007
 

Hibernate is based on object oriented concept like java. so it has better compatibility with java than sql.
In Jdbc we have to mannualy handle exception and every time we need to open/cose the connection,create/close the statement , resultset whatever we have used.
These things are taken care by hibernate.We need not bother about this.
Hibernate uses ORM which is a better approch.
In Jdbc we use .properties file and in hibernate we use .xml file ,which is a better approach.
In Hibernate we can use collection,mapping which are the advantages.
Some advanced features of Hibernate are :
Object-oriented query language
Transparent persistence without byte code processing
Automatic primary key generation 
Object/Relational mapping definition 
High performance 
 

subodh

  • Aug 15th, 2011
 

Hibernate support Object Oriented Query Languages like, Hibernate Query Language(HQL),Query By Criteria(QBC), Query by Expression(QBE),Named Query and Native Query.
These all type of query language use persistent class name, persistent class object and persistent class property name to perform operation on database table.
BUT when we use SQL we use database table name and column name to perform operation on tables.

Code
  1. USING HQL

  2. ==========

  3. String hql="from Customer c";

  4. Query q=session.createQuery(hql);

  5. List <Customer> Li = q.list();

  6.  

  7. for(Customer c : Li)

  8. {

  9.       s.o.p(c);

  10. }

  11.  

  12. USING QBC

  13. ==========

  14. String hql="from Customer c";

  15. Criteria ctr=session.createCriteria(Customer.class);

  16. List <Customer> Li = ctr.list();

  17.  

  18. for(Customer c : Li)

  19. {

  20.       s.o.p(c);

  21. }

  22.  

  23. NOTE :-> Here, Customer is name of the persistent class.

  Was this answer useful?  Yes

babu

  • Aug 27th, 2011
 

Hibernate minimizes the developers code development from the scratch.
Hibernate engine looks after the query generation.
Main advantage is avoiding the boiler plate code.

  Was this answer useful?  Yes

Ayaz Roomy

  • Apr 27th, 2012
 

- Hibernate is something which is totally based on ObjectOrientedProgramming concept.where as SQL is based on

Querys .But Hibernate also uses sql queries but it is using Objects to handle the results from Database.

- Where as in JDBC we have to open and set connection whenever we using any database connection.it take
time and also slow in processing of data while comparing to Hibernate.

  Was this answer useful?  Yes

ABHAY RAI

  • Aug 25th, 2012
 

Hibernate provide object oriented functionality and hibernate easily migrate different database without any query changes.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions