RepositoryBackedSession { public synchronized void commit() { if (!invalid) { manager.invokeCommit(this); } } RepositoryBackedSession(SessionData sessionData, SessionManager manager, SessionFactory factory); protected  RepositoryBackedSession(RepositoryBackedSession linked); void setMaxInactiveInterval(int maxInactiveInterval); Object getAttribute(String key); @SuppressWarnings({ "rawtypes" }) Enumeration getAttributeNames(); List<String> getAttributeNamesWithValues(); long getCreationTime(); String getId(); long getLastAccessedTime(); int getMaxInactiveInterval(); void invalidate(); void doInvalidate(boolean expired); boolean isNew(); void removeAttribute(String name); Attribute getAttributeFromCache(String name); void setAttribute(String key, Object value); synchronized void commit(); boolean isValid(); boolean isExpired(); boolean isDirty(); Runnable getCommitter(); SessionData getSessionData(); boolean isCommitted(); void setCommitted(boolean committed); SessionManager getSessionManager(); int getConcurrentUses();  }
@Test public void testCommit() { sessionData.setMandatoryRemoteKeys(Collections.singleton("NonCacheable")); RepositoryBackedSession rbs = new RepositoryBackedSession(sessionData, manager, factory); rbs.setAttribute("Test", "value"); rbs.setAttribute("TestChanged", "valueOriginal"); rbs.setAttribute("TestChanged", "valueFinal"); rbs.setAttribute("TestToDelete", "value"); rbs.removeAttribute("TestToDelete"); rbs.setAttribute("NonCacheable", "valueNonCacheable"); rbs.getCommitter().run(); verify(repository).startCommit(sessionData("1")); verify(transaction).removeAttribute("TestToDelete"); verify(transaction).addAttribute("Test", "value"); verify(transaction).addAttribute("TestChanged", "valueFinal"); verify(transaction, never()).addAttribute("TestChanged", "valueOriginal"); verify(transaction, never()).addAttribute(eq("NonCacehable"), anyString()); }