What is database persistence?How well it is implemented in Hibernate

Editorial / Best Answer

mani.sivapuram  

  • Member Since May-2010 | Feb 14th, 2011


There are mainly three states in hibernate
a) Transient state
b) Persistant state
c) Detatched state

Take the employee object place the data in that object like usename, password, empid. Now the state of the object is transient state, when we write the statement given below

session.save(employeeObject);

Now the state of the object is persistent since the employee object is kept in session object then when we write the statement given below

transaction.commit();

When we apply the above statement then the employee object is going to linked with database and the data is stored in related table of that database. Since the emp object in persistent state only the data is stored in database other wise the data is not stored in database.

After the commit operation it becomes into detached state. If anybody wants to store the emp object into database then in detached state it is not possible.

Showing Answers 1 - 9 of 9 Answers

Sony

  • Apr 5th, 2007
 

Hibernate has an extremely sophisticated granular two-level cache architecture. It is possible to enable or disable the use of the (second-level) process or cluster level cache for a particular class or collection role. There is support for pluggable cache implementations, including EHCache, JBossCache, SwarmCache, Tangosol Coherence Cache. There is also a granular query result set cache. All this flexibility comes at the cost of complexity and can occasionally be tricky for new users.

it will helps hibernate to do the persitence work more feasible

  Was this answer useful?  Yes

prasadkuppa

  • Apr 23rd, 2008
 

Preserving the data inside a database is database persistence. Persistence is once of the fundamental concepts of application developement.

There are many alternatives to implement persistence. Object/relational mapping (ORM) is the technique that Hibernate tool uses to persist the data. By using ORM toll like Hibernate, you get advantages like low SQL coding ( improved productivity), easy to maintain the system and also leads to better performance.

There are mainly three states in hibernate
a) Transient state
b) Persistant state
c) Detatched state


Take the employee object place the data in that object like usename,
password, empid. Now the state of the object is transient state, when we write
the statement given below


session.save(employeeObject);


Now the state of the object is persistent since the employee object is kept
in session object then when we write the statement given below


transaction.commit();


When we apply the above statement then the employee object is going to linked
with database and the data is stored in related table of that database. Since
the emp object in persistent state only the data is stored in database other
wise the data is not stored in database.


After the commit operation it becomes into detached state. If anybody wants
to store the emp object into database then in detached state it is not possible.


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