pksiv wrote:
incarnateX wrote:
Hi,
Is there a way to make an entry in a table without using session.save().
Thanks in advance.
From,
Santo.
Just curious... if you're using Hibernate, why would you want to insert a row without using the Session.save() method ?
The save() method accepts a detached object and persists it to the database. In my case, the object Iam creating needs a lot of child objects to be loaded which results to a lot of overhead which I want to avoid. Just in case you need an example......
Code:
class A{
/* persistent child*/
B b;
public A(B b){
this.b = b;
}
}
----------------------------
_b = session.load(...);
A _a = new A(_b);
session.save(_a);
In this case in order to persist "_a" I first need to load "_b" which is something I wish to avoid. That's the reason why I was wanting to INSERT directly through HQL.