Hibernate 5多租户和交易

时间:2015-11-06 12:52:51

标签: java spring jpa transactions hibernate-5.x

我正在使用Hibernate 5的多租户功能在当前是单租户并使用Hibernate 4的应用程序中实现Multitenancy。我依靠Spring来确保管理事务。

但是在Hibernate 5中添加@Transactional属性会引发错误     SessionFactory configured for multi-tenancy, but no tenant identifier specified

根据对类似问题的回答,我实施了CurrentTenantIdentifierResolver接口,以说明正在使用getCurrentSession()的{​​{1}}方法。我已经实现了SessionFactory接口。

但是我现在得到了ClassNotFound异常MultiTenantConnectionProvider。我知道这是因为这个类在Hibernate 5包中没有。

使用Spring 4.1.6和Hibernate 5管理事务的正确方法是什么?

0 个答案:

没有答案