Devskiller / jpa2ddl

JPA Schema Generator Plugin
Apache License 2.0
110 stars 33 forks source link

UPDATE always generates sequences even if they exist #35

Closed felinira closed 3 years ago

felinira commented 3 years ago

Thank you for this tool. This is the exact compromise between magic and complexity I was looking for.

I am using org.hibernate.dialect.PostgreSQL9Dialect and when run this script with action UPDATE it will always generate sequences for id columns:

create sequence public.userID_seq start 1 increment 1;

It does this even when the sequences were already generated in a previous file. This causes errors because the sequences already exist. The setting "skipSequences" does not have an effect.

My sequences are annotated like this:

    @Id
    @SequenceGenerator(name="userId_seq", sequenceName="userId_seq", allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="userId_seq")
    private int userId;
jkubrynski commented 3 years ago

Resolved by adding H2PostgreSQL95Dialect dialect which uses SequenceInformationExtractorH2DatabaseImpl to retrieve information about the sequences. Will be released with the next version

felinira commented 3 years ago

Thank you!

jkubrynski commented 3 years ago

Available in version 0.10.0