Buggy code:
public EntityPersister getEntityPersister ( String entityName ) throws MappingException { } @ Override public Map < String , CollectionPersister > getCollectionPersisters ( ) { } @ Override public Map < String , EntityPersister > getEntityPersisters ( ) { } public CollectionPersister getCollectionPersister ( String role ) throws MappingException { } public Settings getSettings ( ) { } @ Override public SessionFactoryOptions getSessionFactoryOptions ( ) { } public JdbcServices getJdbcServices ( ) { } public Dialect getDialect ( ) { } public Interceptor getInterceptor ( ) { } public SQLExceptionConverter getSQLExceptionConverter ( ) { } public SqlExceptionHelper getSQLExceptionHelper ( ) { } public Set < String > getCollectionRolesByEntityParticipant ( String entityName ) { } @ Override public Reference getReference ( ) { } @ Override public NamedQueryRepository getNamedQueryRepository ( ) { } public void registerNamedQueryDefinition ( String name , NamedQueryDefinition definition ) { } public NamedQueryDefinition getNamedQuery ( String queryName ) { } public void registerNamedSQLQueryDefinition ( String name , NamedSQLQueryDefinition definition ) { } public NamedSQLQueryDefinition getNamedSQLQuery ( String queryName ) { } public ResultSetMappingDefinition getResultSetMapping ( String mappingName ) { } public Type getIdentifierType ( String className ) throws MappingException { } public String getIdentifierPropertyName ( String className ) throws MappingException { } public Type [ ] getReturnTypes ( String queryString ) throws HibernateException { } public String [ ] getReturnAliases ( String queryString ) throws HibernateException { } public ClassMetadata getClassMetadata ( Class persistentClass ) throws HibernateException { } public CollectionMetadata getCollectionMetadata ( String roleName ) throws HibernateException { } public ClassMetadata getClassMetadata ( String entityName ) throws HibernateException { } public String [ ] getImplementors ( String className ) throws MappingException { } @ Override public String getImportedClassName ( String className ) { } public Map < String , ClassMetadata > getAllClassMetadata ( ) throws HibernateException { } public Map getAllCollectionMetadata ( ) throws HibernateException { } public Type getReferencedPropertyType ( String className , String propertyName ) throws MappingException { } public ConnectionProvider getConnectionProvider ( ) { } public void close ( ) throws HibernateException { } public Cache getCache ( ) { } public void evictEntity ( String entityName , Serializable id ) throws HibernateException { } public void evictEntity ( String entityName ) throws HibernateException { } public void evict ( Class persistentClass , Serializable id ) throws HibernateException { } public void evict ( Class persistentClass ) throws HibernateException { } public void evictCollection ( String roleName , Serializable id ) throws HibernateException { } public void evictCollection ( String roleName ) throws HibernateException { } public void evictQueries ( ) throws HibernateException { } public void evictQueries ( String regionName ) throws HibernateException { } public UpdateTimestampsCache getUpdateTimestampsCache ( ) { } public QueryCache getQueryCache ( ) { } public QueryCache getQueryCache ( String regionName ) throws HibernateException { } public Region getSecondLevelCacheRegion ( String regionName ) { } public Region getNaturalIdCacheRegion ( String regionName ) { } @ SuppressWarnings ( { "unchecked" } ) public Map getAllSecondLevelCacheRegions ( ) { } public boolean isClosed ( ) { } public Statistics getStatistics ( ) { } public StatisticsImplementor getStatisticsImplementor ( ) { } public FilterDefinition getFilterDefinition ( String filterName ) throws HibernateException { } public boolean containsFetchProfileDefinition ( String name ) { } public Set getDefinedFilterNames ( ) { } public IdentifierGenerator getIdentifierGenerator ( String rootEntityName ) { } private TransactionFactory transactionFactory ( ) { } private boolean canAccessTransactionManager ( ) { } private CurrentSessionContext buildCurrentSessionContext ( ) { } @ Override public ServiceRegistryImplementor getServiceRegistry ( ) { } @ Override public EntityNotFoundDelegate getEntityNotFoundDelegate ( ) { } public SQLFunctionRegistry getSqlFunctionRegistry ( ) { } public FetchProfile getFetchProfile ( String name ) { } public TypeHelper getTypeHelper ( ) { } static class SessionBuilderImpl implements SessionBuilderImplementor { private static final Logger log = CoreLogging . logger ( SessionFactoryImpl . SessionBuilderImpl . class ) ; private final SessionFactoryImpl sessionFactory ; private SessionOwner sessionOwner ; private Interceptor interceptor ; private Connection connection ; private ConnectionReleaseMode connectionReleaseMode ; private boolean autoClose ; private boolean autoJoinTransactions = true ; private boolean flushBeforeCompletion ; private String tenantIdentifier ; private List < SessionEventListener > listeners ; SessionBuilderImpl ( SessionFactoryImpl sessionFactory ) { } protected TransactionCoordinatorImpl getTransactionCoordinator ( ) { } protected TransactionCompletionProcesses getTransactionCompletionProcesses ( ) { } @ Override public Session openSession ( ) { } @ Override public SessionBuilder owner ( SessionOwner sessionOwner ) { } @ Override public SessionBuilder interceptor ( Interceptor interceptor ) { } @ Override public SessionBuilder noInterceptor ( ) { } @ Override public SessionBuilder connection ( Connection connection ) { } @ Override public SessionBuilder connectionReleaseMode ( ConnectionReleaseMode connectionReleaseMode ) { } @ Override public SessionBuilder autoJoinTransactions ( boolean autoJoinTransactions ) { } @ Override public SessionBuilder autoClose ( boolean autoClose ) { } @ Override public SessionBuilder flushBeforeCompletion ( boolean flushBeforeCompletion ) { } @ Override public SessionBuilder tenantIdentifier ( String tenantIdentifier ) { } @ Override public SessionBuilder eventListeners ( SessionEventListener ... listeners ) { } @ Override public SessionBuilder clearEventListeners ( ) { } } public static class StatelessSessionBuilderImpl implements StatelessSessionBuilder { private final SessionFactoryImpl sessionFactory ; private Connection connection ; private String tenantIdentifier ; public StatelessSessionBuilderImpl ( SessionFactoryImpl sessionFactory ) { } @ Override public StatelessSession openStatelessSession ( ) { <START_BUG> return new StatelessSessionImpl ( connection , tenantIdentifier , sessionFactory ) ; <END_BUG> } @ Override public StatelessSessionBuilder connection ( Connection connection ) { } @ Override public StatelessSessionBuilder tenantIdentifier ( String tenantIdentifier ) { } } @ Override public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy ( ) { } @ Override public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver ( ) { } private void writeObject ( ObjectOutputStream out ) throws IOException { } private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } private Object readResolve ( ) throws InvalidObjectException { } private static SessionFactory locateSessionFactoryOnDeserialization ( String uuid , String name ) throws InvalidObjectException { } void serialize ( ObjectOutputStream oos ) throws IOException { } static SessionFactoryImpl deserialize ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { } }

Fix:
return new StatelessSessionImpl ( connection , tenantIdentifier , sessionFactory , sessionFactory . settings . getRegionFactory ( ) . nextTimestamp ( ) ) ;