Hi
I need a session method to determine if an object of specified class is already associated with the session.
When I call session.get(class,id), I obtain an instance of the given class, but I don't know if that instance was already associated with the session or was just loaded.
I have the id and the class of the object and only need some data. I don't change it and don't want to save it at the end, just release it. But when I call evict at the end of my function to prevent NonUniqueObjectExceptions I would loose a possible instance that is in use in other parts of the program and still needs to be saved.
I have found several similar topics on that problem but no usefull answers.
My questions:
1. How can I write a function like containsObject(class,id)
2. Why does the Hibernate team not tell us why there is no such function (any deep reasons?) or if it is planned in future releases?
Thanks for your help
Bruno
|