而且主键的生成策略不能使用GenerationType.AUTO或GenerationType.IDENTITY,否则会出现异常:
org.hibernate.MappingException: Cannot use identity column key generation with
因为TABLE_PER_CLASS策略每个表都是单独的,没有并且各表的主键没有任何关系,所以不能使用GenerationType.AUTO或GenerationType.IDENTITY主键生成策略,可以使用GenerationType.TABLE。
具体可参考:http://stackoverflow.com/questions/916169/cannot-use-identity-column-key-generation-with-union-subclass-table-per-clas
如果超类是抽象类,那么不会生成对应的表。如果超类是具体的类,那么会生成对应的表。以上实例使用JPA的hibernate实现测试通过。