Cannot use identity column key generation with ( TABLE_PER_CLASS )

后端 未结 6 2036
囚心锁ツ
囚心锁ツ 2020-12-02 07:12

com.something.SuperClass:

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class SuperClass implements Seria         


        
6条回答
  •  再見小時候
    2020-12-02 08:09

    In our case, we use a PostreSQL database for dev and production and an in-memory hsqldb database for tests. We are using a sequence in both cases to generate an id. Apparently GenerationType.AUTO defaults to SEQUENCE for postgres, but failed in our local tests (must default to something else for hsqldb).

    So the solution that worked for us, explicitly use GenerationType.SEQUENCE.

提交回复
热议问题