/** {@inheritDoc} */
  @Override
  public void onSessionStart(CacheStoreSession ses) {
    if (ses.attachment() == null) {
      try {
        Session hibSes = sesFactory.openSession();

        ses.attach(hibSes);

        if (ses.isWithinTransaction()) hibSes.beginTransaction();
      } catch (HibernateException e) {
        throw new CacheWriterException(
            "Failed to start store session [tx=" + ses.transaction() + ']', e);
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public void stop() throws IgniteException {
   if (closeSesOnStop && sesFactory != null && !sesFactory.isClosed()) sesFactory.close();
 }