delpouve wrote:
session.load(class, serializable) look at javadoc
for composite id, a best practice is to have a class reprenting the composite id. This class must implements serializable so you can also use it for session.load
from the javadoc
You should not use this method to determine if an instance exists (use find() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
use the following approach:
Code:
Integer count =
(Integer)session.find("count(obj) from YourClass obj where obj.id.key1=val1 AND obj.id.ke2=val2").iterate().next();