[hibernate-issues] [JIRA] (HHH-13939) H2Dialect @GeneratedValue regression on schema generation, uses sequence instead of generated by default as identity

IT Support (JIRA) jira at hibernate.atlassian.net
Tue Apr 7 16:40:04 EDT 2020


IT Support ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A7c7fc415-3805-43c8-9dfa-7cbe1117db94 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13939?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 ) HHH-13939 ( https://hibernate.atlassian.net/browse/HHH-13939?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 ) H2Dialect @GeneratedValue regression on schema generation, uses sequence instead of generated by default as identity ( https://hibernate.atlassian.net/browse/HHH-13939?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.0.0.Final, 5.4.13 Assignee: IT Support ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A7c7fc415-3805-43c8-9dfa-7cbe1117db94 ) Components: hibernate-jpamodelgen Created: 07/Apr/2020 13:40 PM Environment: Java 7, Java 8, h2-1.4.200.jar Labels: documentation regression Priority: Major Reporter: IT Support ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A7c7fc415-3805-43c8-9dfa-7cbe1117db94 )

In Hibernate 4.x, specifically 4.3.11

*persistence.xml snippet*
<property name= "hibernate.dialect" value= "org.hibernate.dialect.H2Dialect" />
<property name= "hibernate.hbm2ddl.auto" value= "create-drop" />
<property name= "javax.persistence.jdbc.url" value= "jdbc:h2:mem:unittests" />

*4.x generated SQL*
Hibernate: create table dbo.office (officeid bigint generated by default as identity , office varchar (255) not null , description varchar (255), sequence varchar (255), orgid bigint not null , primary key (officeid))

*5.x generated SQL*
create table dbo.office (officeid bigint not null , office varchar (255) not null , description varchar (255), sequence varchar (255), orgid bigint not null , primary key (officeid))

create sequence hibernate_sequence start with 1 increment by 1

I have confirmed the dialect values are sensible. The error seems to be inside / around the SessionFactoryImpl's identifierGenerators. While the dialect indicates Identity generation, the generator seems to be a result of DefaultIdentifierGeneratorFactory, which produces sequence based ids.

Specifically the metadata.getEntityBindings() returns a PersistentClass model where the identifier is a SimpleValue whose identifierGenerator is a SequenceStyleGenerator

This can be backtracked to:

*EntityManagerFactoryBuilderImpl*
private MetadataImplementor metadata() {
		if ( this.metadata == null ) {
			this.metadata = MetadataBuildingProcess.complete( managedResources, metamodelBuilder.getMetadataBuildingOptions() );
		}
		return metadata;
	}

This is not related to:

* HHH-13727 ( https://hibernate.atlassian.net/browse/HHH-13727 ) Closed
* HHH-13597 ( https://hibernate.atlassian.net/browse/HHH-13597 ) Closed

( https://hibernate.atlassian.net/browse/HHH-13939#add-comment?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13939#add-comment?atlOrigin=eyJpIjoiZjBhNDFmYjNmMDAyNDU0M2I4ODk2OGFjZTk0MGU2MDEiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100124- sha1:c13ca0d )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200407/539a4815/attachment.html 


More information about the hibernate-issues mailing list