/** INTERNAL: Return the session to be used for the class. */ public AbstractSession getSessionForClass(Class domainClass) throws ValidationException { if (domainClass == null) { // CR2114; we don't have a session name. Return us. return this; } String sessionName = getSessionNamesByClass().get(domainClass); if (sessionName == null) { throw ValidationException.noSessionRegisteredForClass(domainClass); } return getSessionsByName().get(sessionName); }