Hi,
But that can also be done through overriding Interceptor i.e.
Configuration configuration = new Configuration();
configuration.setInterceptor(new UserInterceptor());
sessionFactory = configuration.configure().buildSessionFactory();
public class UserInterceptor extends EmptyInterceptor{
public Boolean isTransient(Object object) {
return Boolean.TRUE;
}
}
So here we have override the method called isTransient(), which return true, that means this object is transient no need to save.
In this case it also does not generate select, but again it leads to another problem that, it does not store reference for referencing of object being save.
Like
A has reference of C,
First we store C,
Then we store A, but while storing A it does not save reference of C into table of A, instead of that it saved that as a null value.
This happens in case of JTA transaction only.