240 发简信
IP属地:浙江
  • 你好,项目跑起来的时候会报这个错
    Caused by: org.hibernate.HibernateException: SessionFactory configured for multi-tenancy, but no tenant identifier specified
    at org.hibernate.internal.AbstractSessionImpl.<init>(AbstractSessionImpl.java:88) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:242) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1332) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.jpa.internal.EntityManagerImpl.internalGetSession(EntityManagerImpl.java:133) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:174) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.jpa.internal.EntityManagerImpl.<init>(EntityManagerImpl.java:83) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.jpa.internal.EntityManagerFactoryImpl.internalCreateEntityManager(EntityManagerFactoryImpl.java:319) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
    at org.hibernate.jpa.internal.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:286) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
    应该是SpringDataJpa初始化的时候去创建Dao时必须要有一个指定的Session。请问你碰到过这个问题吗

    Spring boot + Hibernate 多租户的使用

    本文发布在个人博客,因为Github Pages在百度不会被收录,所以为了能帮助到更多的人,特意发到简书上,大家可以关注我的博客:http://lanyuanxiaoyao....

  • 120
    Spring boot + Hibernate 多租户的使用

    本文发布在个人博客,因为Github Pages在百度不会被收录,所以为了能帮助到更多的人,特意发到简书上,大家可以关注我的博客:http://lanyuanxiaoyao....