Hibernate newbie.

S

shaji.cc

Hello all:

I am a newbie to hibernate and ORM concepts. I just want to make sure
whether my understanding is correct or not.

Consider a client-server scenario. I am mapping an object with a table
from the database at the server. So hibernate makes this object
persistent by storing the current state of this object. Now server
sends response to the client and request comes back. Now server need
not contact database again to get the object mappings. (Otherwise you
need to to keep the whole object in the session, which makes the
session bulky)
Is this understanding correct?


How actually hibernate achieve persistence? Where do they actually save
the ORM mapping details?
If I have 10 tables in database, will hibernate make extra tables in
database to store these details?
Does hibernate use HSQL for this purpose?

Hope my question is clear. Can anybody answer to my queries.

-TIA,
Shaji.
 
C

Chris Smith

Consider a client-server scenario. I am mapping an object with a table
from the database at the server. So hibernate makes this object
persistent by storing the current state of this object. Now server
sends response to the client and request comes back. Now server need
not contact database again to get the object mappings. (Otherwise you
need to to keep the whole object in the session, which makes the
session bulky)
Is this understanding correct?

I'm afraif I don't understand what it is that you are asking. The
mappings are stored in local resources witing the application, not in
the database. Depending on your concurrency requirements, though, you
may need to contact the database again and retrieve a new copy of the
persistent object (in case some entity may have updated the database).
How actually hibernate achieve persistence? Where do they actually save
the ORM mapping details?

They are in hibernate mapping files, which are XML files that are
generally stored as resources in your application.
If I have 10 tables in database, will hibernate make extra tables in
database to store these details?

No, and that's important. The O/R mapping isn't something fundamental
about the database. It's an application-level issue. The same database
may have three different applications that use it, and all three may
have different O/R mappings that map a different subset of data that
they care about.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
B

Bryce

Hello all:

I am a newbie to hibernate and ORM concepts. I just want to make sure
whether my understanding is correct or not.

Consider a client-server scenario. I am mapping an object with a table
from the database at the server. So hibernate makes this object
persistent by storing the current state of this object. Now server
sends response to the client and request comes back. Now server need
not contact database again to get the object mappings. (Otherwise you
need to to keep the whole object in the session, which makes the
session bulky)

No.

Think of Hibernate as a way to map an object to a database. Suppose
you have a table:

table TEST {
ID int,
NAME varchar2(50),
....
}

You could have a class:

class Test {
private int id;
private String name;
....
}

and a mapping file which maps class Test to table TEST (see hibernate
website for details on creating this file).

Hibernate will persist the data to table TEST, it will generate the
SQL required to create/update/retrieve the data, and instead of using
JDBC calls, you just call Hibernate functions.

Thats it in a very (generalized) nutshell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top