I have a class like this (with getters and setters, all mapped to hibernate, each with a sequence to oracle DB)
public class A{
private int id;
private B b;
private C c;
}
classes B and C are simple classes also mapped with ids mapped to sequences
i'm trying to create an object "A" and save it to the database.
So i create an A object and populate it with a B object and call
saveOrUpdate(a)
so now i have "a" and "b" sequences generated. Then i do some calculations and create an instance of "C" and set it to "a"
Up to here, everything's great. I now need to get "c"'s id so i do some checks before i flush and commit.
But saveOrUpdate won't work here because the object is no longer transient.
According to hibernate docs on saveOrUpdate: "if the object is already persistent in this session, do nothing "
(can't post the actual code because it's too long)
Any help is appreciated
Thanks


Reply With Quote
