Nikolay, Here's the code I use to pull an object out of the session cache:
// session is an instance variable declared as SessionImpl private Object getCachedObject(Class clazz, Serializable id) { try { ClassPersister persister = session.getFactory().getPersister(clazz); Key key = new Key(id, persister); Object entity = session.getEntity(key); return session.proxyFor(persister, key, entity); } catch (Exception e) { return null; } } It looks like you can add an object using SessionImpl.addEntity(), but this is private. The closest public method that might work is SessionImpl.addUninitializedEntity(). Maybe someone could verify if this is a safe way to add an object to the Session cache? Regards, John -----Original Message----- From: Nikolay Ganev [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 5:45 AM To: hibernate Subject: [Hibernate] question HI all, I need to add and retrieve object to/from Hibernate Session. In other words I need 2 methods in session: getObject() setObject(...) SessionImpl class is declared final, so i cannot extend it and make my own implementation of Session. Can anybody help me how to make this functionality? Thx -- Best regards, Nikolay mailto:[EMAIL PROTECTED] ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel