hibernate5-ddl-maven-plugin
hibernate5-ddl-maven-plugin copied to clipboard
@SequenceGenerator allocationSize not considered when generating DDL
I am simply using the plugin as:
<plugin>
<groupId>de.jpdigital</groupId>
<artifactId>hibernate54-ddl-maven-plugin</artifactId>
<version>2.3.0</version>
<configuration>
<dialects>
<param>POSTGRESQL9</param>
</dialects>
<packages>
<param>com.corp.proj.pack.data.entity</param>
</packages>
<outputFileNamePrefix>create_</outputFileNamePrefix>
</configuration>
<executions>
<execution>
<goals>
<goal>gen-ddl</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
and I am having the entity defined as:
@MappedSuperclass
public abstract class AbstractEntity implements Serializable
{
@Id
@SequenceGenerator(name = "my_id_gen", sequenceName = "my_id_sequence", initialValue = 200, allocationSize = 100)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "my_id_gen")
@Column(name = "id", updatable = false, nullable = false)
private long id;
}
but the DDL generated by the plugin does not take the allocationSize
into account and generate the following DDL:
create sequence my_id_sequence start 1 increment 1;
which causes an exception at runtime:
org.hibernate.MappingException: The increment size of the [my_id_sequence] sequence is set to [100] in the entity mapping while the associated database sequence increment size is [1].
Is this a bug in the plugin that is does not consider the allocationSize
or am I missing any configuration to get this generated correctly?