S
shaji
Hi:
I had earlier posted a question regarding 'how persistence achieved
using hibernate'. Probably my idea of persistence might be wrong! I
hope some of you will help me out.
Is it possible to use a single session for several database
transanctions with disconnections between each request(from browser).
So are we carrying the session details across the network? (This
will increase the payload and effect the
performance, right?)
Otherwise how sessions are restored across http-sessions?
Now, I think of Hibernate as a way to map an object to a database.
you have a table:
table TEST {
ID int,
NAME varchar2(50),
....
}
You could have a class:
class Test {
private int id;
private String name;
....
}
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. (These statements I am
recalling from another thread appeared here).
We know that, database calls are costly operations mainly due to
connection overheads in establishing JDBC conn. Hibernate also pays
this cost each time it tries to connect to database.
Suppose we created one persistent class of Test in one session. We uses
it. Now the response went back to browser and another request comes in.
Is the class Test created last time still persistent?
Or hibernate obtains a new instance of Test by invoking all those JDBC
conn procedures again?
If it is the second case, what is actually persistence. Everytime you
need the object, you have to contact database. So where is the gain?
Any help will be deeply apprecitated.
-Shaji.
I had earlier posted a question regarding 'how persistence achieved
using hibernate'. Probably my idea of persistence might be wrong! I
hope some of you will help me out.
Is it possible to use a single session for several database
transanctions with disconnections between each request(from browser).
So are we carrying the session details across the network? (This
will increase the payload and effect the
performance, right?)
Otherwise how sessions are restored across http-sessions?
Now, I think of Hibernate as a way to map an object to a database.
you have a table:
table TEST {
ID int,
NAME varchar2(50),
....
}
You could have a class:
class Test {
private int id;
private String name;
....
}
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. (These statements I am
recalling from another thread appeared here).
We know that, database calls are costly operations mainly due to
connection overheads in establishing JDBC conn. Hibernate also pays
this cost each time it tries to connect to database.
Suppose we created one persistent class of Test in one session. We uses
it. Now the response went back to browser and another request comes in.
Is the class Test created last time still persistent?
Or hibernate obtains a new instance of Test by invoking all those JDBC
conn procedures again?
If it is the second case, what is actually persistence. Everytime you
need the object, you have to contact database. So where is the gain?
Any help will be deeply apprecitated.
-Shaji.