Exception in thread "main" java.lang.ExceptionInInitializerError
    at cn.itcast.test.Demo1.add(Demo1.java:40)
    at cn.itcast.test.Demo1.main(Demo1.java:14)
Caused by: org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: cn.itcast.domain.Sales
    at org.hibernate.persister.entity.UnionSubclassEntityPersister.<init>(UnionSubclassEntityPersister.java:67)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:61)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
    at cn.itcast.dao.HibernateUtil.<clinit>(HibernateUtil.java:20)
    ... 2 more

 

这个是在我使用union-subclass的时候出现的,不能使用identity作为主键生成策略。原因是不允许出现主键相同。

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2017-12-12
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2021-05-21
  • 2021-07-18
  • 2021-05-30
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-04-11
相关资源
相似解决方案