Marco Zühlke ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61f9220... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNzlmNTkzZTcx... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16369?atlOrigin=eyJpIjoiNzlmNT... ) HHH-16369 ( https://hibernate.atlassian.net/browse/HHH-16369?atlOrigin=eyJpIjoiNzlmNT... ) PostGIS function st_extent(geometry) does not work ( https://hibernate.atlassian.net/browse/HHH-16369?atlOrigin=eyJpIjoiNzlmNT... )
Change By: Marco Zühlke ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61f9220... )
I'm troubleshooting with an issue when using PostGIS function st_extent _st_extent(geometry)_.
Entity/Repository:
{code:java}@Entity
@Table(name = "geometry_entity")
@Data
public class GeometryEntity {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator")
private UUID id;
@Column(name = "the_geom")
private Polygon geometry;
}
public interface GeometryEntityRepository extends CrudRepository JpaRepository <GeometryEntity, UUID> {
@Query(value = "select extent(geometry) from GeometryEntity")
Optional<Polygon> getExtentByJPQL();
@Query(value = "select st_extent(geometry) from GeometryEntity")
Optional<Polygon> getExtentByST_PrefixedFunctionName();
@Query(value = "select st_extent(the_geom) from geometry_entity", nativeQuery = true)
Optional<Polygon> getExtentByNativeQuery();
}{code}
According to the doc [https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_... extent _extent_ AND st_extent _st_extent_ should work.
I have three different queries, two of them are using JPQL, the other one is written native.
None of them work, all results in an error.
The attempt to call {{getExtentByJPQL}}() results in:
{noformat}2023-03-24T17:19:37.115+01:00 ERROR 456308 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: function extent(geometry) does not exist
Hinweis: No function matches the given name and argument types. You might need to add explicit type casts.
Position: 8
org.springframework.dao.InvalidDataAccessResourceUsageException: JDBC exception executing SQL [select extent(g1_0.the_geom) from field g1_0]; SQL [n/a]{noformat}
The attempt to call {{getExtentByST_PrefixedFunctionName}}() and {{getExtentByNativeQuery()}}results in:
{noformat}org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [org.locationtech.jts.geom.Polygon]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:322){noformat}
Just as a side note, using st_envelope _st_envelope_ / _envelope_ instead of st_extent _st_extent_ / _extent_ works on JPQL queries, using a native query ends up with same {{ConverterNotFoundException}} I get by using st_extent _st_extent_.
* spring-boot:3.0.4
* hibernate-spatial:6.1.7
* postgres/postgis:15-3.3
Test case to reproduce the error:
[https://github.com/marcozet/spring-boot-3-hibernate-spatial|https://githu...]
( https://hibernate.atlassian.net/browse/HHH-16369#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16369#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )
Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMWZhNTBhZWYw... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16378?atlOrigin=eyJpIjoiMWZhNT... ) HHH-16378 ( https://hibernate.atlassian.net/browse/HHH-16378?atlOrigin=eyJpIjoiMWZhNT... ) SQM fails to resolve target type of association defined in mappersuperclass with generics ( https://hibernate.atlassian.net/browse/HHH-16378?atlOrigin=eyJpIjoiMWZhNT... )
Issue Type: Bug Assignee: Unassigned Components: hibernate-core Created: 27/Mar/2023 03:12 AM Fix Versions: 6.2.0 Priority: Major Reporter: Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
This is a regression compared to Hibernate ORM 5.6.
I confirmed it affects 6.2.0.CR4, but it probably also affects 6.0 and 6.1.
Queries involving an association defined in a mappersuperclass with generics will fail, even though generics are correctly resolved and understood in the mapping phase. The exception:
org.hibernate.query.sqm.InterpretationException: Error interpreting query [from Child where parent.id = :parentId]; this may indicate a semantic (user query) problem or a bug in the parser [from Child where parent.id = :parentId]
at org.hibernate.query.hql.internal.StandardHqlTranslator.translate(StandardHqlTranslator.java:97)
at org.hibernate.internal.AbstractSharedSessionContract.lambda$interpretHql$2(AbstractSharedSessionContract.java:735)
at org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.createHqlInterpretation(QueryInterpretationCacheStandardImpl.java:141)
at org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.resolveHqlInterpretation(QueryInterpretationCacheStandardImpl.java:128)
at org.hibernate.internal.AbstractSharedSessionContract.interpretHql(AbstractSharedSessionContract.java:732)
at org.hibernate.internal.AbstractSharedSessionContract.interpretAndCreateSelectionQuery(AbstractSharedSessionContract.java:709)
at org.hibernate.internal.AbstractSharedSessionContract.createSelectionQuery(AbstractSharedSessionContract.java:761)
at org.hibernate.orm.test.bytecode.enhancement.association.GenericAssociationTest.lambda$testMerge$1(GenericAssociationTest.java:40)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:96)
at org.hibernate.testing.transaction.TransactionUtil2.lambda$inTransaction$0(TransactionUtil2.java:76)
at org.hibernate.testing.transaction.TransactionUtil2.inSession(TransactionUtil2.java:35)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:74)
at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.inTransaction(BaseCoreFunctionalTestCase.java:555)
at org.hibernate.orm.test.bytecode.enhancement.association.GenericAssociationTest.testMerge(GenericAssociationTest.java:39)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: Could not resolve attribute 'id' of 'java.lang.Object'
at org.hibernate.query.sqm.SqmPathSource.getSubPathSource(SqmPathSource.java:61)
at org.hibernate.query.sqm.tree.domain.AbstractSqmPath.get(AbstractSqmPath.java:167)
at org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath.resolvePathPart(SqmEntityValuedSimplePath.java:55)
at org.hibernate.query.hql.internal.DomainPathPart.resolvePathPart(DomainPathPart.java:42)
at org.hibernate.query.hql.internal.BasicDotIdentifierConsumer.consumeIdentifier(BasicDotIdentifierConsumer.java:91)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSimplePath(SemanticQueryBuilder.java:5179)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitIndexedPathAccessFragment(SemanticQueryBuilder.java:5126)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitGeneralPathFragment(SemanticQueryBuilder.java:5095)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitGeneralPathExpression(SemanticQueryBuilder.java:1723)
at org.hibernate.grammars.hql.HqlParser$GeneralPathExpressionContext.accept(HqlParser.java:7590)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
at org.hibernate.grammars.hql.HqlParserBaseVisitor.visitBarePrimaryExpression(HqlParserBaseVisitor.java:720)
at org.hibernate.grammars.hql.HqlParser$BarePrimaryExpressionContext.accept(HqlParser.java:7064)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitComparisonPredicate(SemanticQueryBuilder.java:2427)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitComparisonPredicate(SemanticQueryBuilder.java:253)
at org.hibernate.grammars.hql.HqlParser$ComparisonPredicateContext.accept(HqlParser.java:6111)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitWhereClause(SemanticQueryBuilder.java:2271)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitWhereClause(SemanticQueryBuilder.java:253)
at org.hibernate.grammars.hql.HqlParser$WhereClauseContext.accept(HqlParser.java:5910)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuery(SemanticQueryBuilder.java:1161)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuerySpecExpression(SemanticQueryBuilder.java:937)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuerySpecExpression(SemanticQueryBuilder.java:253)
at org.hibernate.grammars.hql.HqlParser$QuerySpecExpressionContext.accept(HqlParser.java:1818)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSimpleQueryGroup(SemanticQueryBuilder.java:931)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSimpleQueryGroup(SemanticQueryBuilder.java:253)
at org.hibernate.grammars.hql.HqlParser$SimpleQueryGroupContext.accept(HqlParser.java:1711)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSelectStatement(SemanticQueryBuilder.java:418)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.visitStatement(SemanticQueryBuilder.java:377)
at org.hibernate.query.hql.internal.SemanticQueryBuilder.buildSemanticModel(SemanticQueryBuilder.java:295)
at org.hibernate.query.hql.internal.StandardHqlTranslator.translate(StandardHqlTranslator.java:81)
... 28 more
Caused by: org.hibernate.query.SemanticException: Could not resolve attribute 'id' of 'java.lang.Object'
... 58 more
The query:
session.createQuery( "from Child where parent.id = :parentId", Child.class )
.setParameter( "parentId", 1L )
.list()
The model:
@Entity(name = "Parent")
public static class Parent {
@Id
private Long id;
public Parent() {
}
public Parent(Long id) {
this.id = id;
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
}
@MappedSuperclass
public abstract static class AbstractChild<T> {
@OneToOne(optional = false)
private T parent;
public AbstractChild() {
}
public abstract Long getId();
public T getParent() {
return this.parent;
}
public void setParent(T parent) {
this.parent = parent;
}
}
@Entity(name = "Child")
public static class Child extends AbstractChild<Parent> {
@Id
protected Long id;
public Child() {
}
public Child(Long id) {
this.id = id;
}
@Override
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
}
I will provide a PR with a test case for both 5.6 and 6.2 in the comments.
( https://hibernate.atlassian.net/browse/HHH-16378#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16378#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )
Robin De Mol ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTE1OGM2YTdk... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiZTE1OG... ) HHH-16366 ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiZTE1OG... ) UnknownTableReferenceException when selecting entity using IdClass ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiZTE1OG... )
Change By: Robin De Mol ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
See [ reproducer at |https://github. com/hibernate/hibernate-test-case-templates/pull/256]. Running the test yields:
{noformat}org.hibernate.HibernateException: Could not generate fetch : foo.OrganisationUser(o) -> {id}
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7460)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.createFetch(BaseSqmToSqlAstConverter.java:7289)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitIdentifierFetch(BaseSqmToSqlAstConverter.java:7137)
at org.hibernate.sql.results.graph.entity.AbstractEntityResultGraphNode.afterInitialize(AbstractEntityResultGraphNode.java:63)
at org.hibernate.persister.entity.AbstractEntityPersister.createDomainResult(AbstractEntityPersister.java:1217)
at org.hibernate.query.sqm.sql.internal.AbstractSqmPathInterpretation.createDomainResult(AbstractSqmPathInterpretation.java:55)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.lambda$visitSelection$23(BaseSqmToSqlAstConverter.java:2241)
at java.base/java.util.Collections$SingletonList.forEach(Collections.java:4966)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelection(BaseSqmToSqlAstConverter.java:2236)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectClause(BaseSqmToSqlAstConverter.java:2154)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:2022)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:426)
at org.hibernate.query.sqm.tree.select.SqmQuerySpec.accept(SqmQuerySpec.java:122)
at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQueryPart(BaseSemanticQueryWalker.java:221)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQueryPart(BaseSqmToSqlAstConverter.java:1882)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:1567)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:426)
at org.hibernate.query.sqm.tree.select.SqmSelectStatement.accept(SqmSelectStatement.java:222)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.translate(BaseSqmToSqlAstConverter.java:760)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:344)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:267)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:243)
at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:521)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:367)
at org.hibernate.query.sqm.internal.QuerySqmImpl.list(QuerySqmImpl.java:1084)
at org.hibernate.query.Query.getResultList(Query.java:119)
at org.hibernate.bugs.JPAUnitTestCase.UnknownTableReferenceException(JPAUnitTestCase.java:55)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.hibernate.HibernateException: Could not generate fetch : foo.OrganisationUser(o).{id}(u) -> organisation
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7460)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.createFetch(BaseSqmToSqlAstConverter.java:7289)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitFetches(BaseSqmToSqlAstConverter.java:7406)
at org.hibernate.sql.results.graph.AbstractFetchParent.afterInitialize(AbstractFetchParent.java:32)
at org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchImpl.<init>(EmbeddableFetchImpl.java:75)
at org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping.generateFetch(AbstractCompositeIdentifierMapping.java:114)
at org.hibernate.sql.results.graph.FetchParent.generateFetchableFetch(FetchParent.java:108)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7449)
... 55 more
Caused by: org.hibernate.sql.ast.tree.from.UnknownTableReferenceException: Unable to determine TableReference (`ORGANISATION_USER`) for `foo.OrganisationUser(o).{id}(u).organisation.{fk}`
at org.hibernate.sql.ast.tree.from.LazyTableGroup.resolveTableReference(LazyTableGroup.java:256)
at org.hibernate.sql.ast.tree.from.DelegatingTableGroup.resolveTableReference(DelegatingTableGroup.java:62)
at org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor.createDomainResult(SimpleForeignKeyDescriptor.java:302)
at org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor.createDomainResult(SimpleForeignKeyDescriptor.java:251)
at org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping.generateFetch(ToOneAttributeMapping.java:1435)
at org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping.generateFetch(ToOneAttributeMapping.java:106)
at org.hibernate.sql.results.graph.FetchParent.generateFetchableFetch(FetchParent.java:108)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7449)
... 62 more{noformat}
( https://hibernate.atlassian.net/browse/HHH-16366#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16366#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )
Danilov Roman ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNWQ5NTQ4YjUz... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16367?atlOrigin=eyJpIjoiNWQ5NT... ) HHH-16367 ( https://hibernate.atlassian.net/browse/HHH-16367?atlOrigin=eyJpIjoiNWQ5NT... ) H6: Problem with flush and batch is ON ( https://hibernate.atlassian.net/browse/HHH-16367?atlOrigin=eyJpIjoiNWQ5NT... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Attachments: hibernate-orm-6.zip Components: hibernate-core Created: 24/Mar/2023 07:32 AM Priority: Major Reporter: Danilov Roman ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3... )
Hello.
I have two entites:
@Entity
@DynamicUpdate
@Table(name = "laterals")
public class Lateral extends Well implements Serializable {
@Column(name = "id", insertable = false, updatable = false, nullable = false, columnDefinition = "serial")
@Generated(GenerationTime.INSERT)
public Long id;
public Long diameter;
public Long diameter1;
public String paka1;
public String paka2;
}
and
@Entity
@DynamicUpdate
@Table(name = "wells")
@Inheritance(strategy = InheritanceType.JOINED)
public class Well {
@Id
public UUID uuid;
public String name;
public String name1;
public String name2;
public long gui1;
public long gui2;
}
And when first we select one Lateral ,
String hql = "from `Lateral` where uuid = ?1";
Query query = entityManager.createQuery(hql);
query.setParameter(1, uuid);
Lateral lateral = (Lateral) query.getSingleResult();
In the console showed select request.
select * from laterals ...
Then we are begining to change element’s params:
lateral.setName("TEST2");
lateral.setName1("TEST12");
Then we make another any select request:
String hql2 = "from Well where uuid = ?1";
Query query2 = entityManager.createQuery(hql2);
query2.setParameter(1, uuid);
Object object = query2.getSingleResult();
In the console we see update query (with two changed params) and second select query:
update wells set name=?, name1=? where uuid=?
select * from wells ...
Then we are changing more parameters and do persist and flush:
lateral.setDiameter(55L);
lateral.setDiameter1(55L);
lateral.setPaka1("PAKA1");
lateral.setPaka1("PAKA2");
lateral.setName("TEST3");
lateral.setName1("TEST13");
lateral.setName2("TEST23");
lateral.setGui1(111L);
lateral.setGui2(222L);
entityManager.persist(lateral);
entityManager.flush();
And In the console we see update query (with *two* *old params* ) and error:
update wells set name=?, name1=? where uuid=?
2023-03-24 18:21:13 TRACE bind:28 - binding parameter [1] as [BIGINT] - [111]
2023-03-24 18:21:13 TRACE bind:28 - binding parameter [2] as [BIGINT] - [222]
2023-03-24 18:21:13 TRACE bind:28 - binding parameter [3] as [VARCHAR] - [TEST3]
2023-03-24 18:21:13 TRACE bind:28 - binding parameter [4] as [VARCHAR] - [TEST13]
2023-03-24 18:21:13 WARN SqlExceptionHelper:145 - SQL Error: 90008, SQLState: 90008
2023-03-24 18:21:13 ERROR SqlExceptionHelper:150 - Invalid value "4" for parameter "parameterIndex" [90008-214]
1) It turns out that before the second select request the makes a flush although I didn't call him?
2) and after my flush it makes the old update request but with new list of parameters.
Without “batch” everything works without errors (and on hibernate 5 too).
Test cases attached.
( https://hibernate.atlassian.net/browse/HHH-16367#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16367#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )
Robin De Mol ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDVkMDdlZmMw... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiNDVkMD... ) HHH-16366 ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiNDVkMD... ) UnknownTableReferenceException when selecting entity using IdClass ( https://hibernate.atlassian.net/browse/HHH-16366?atlOrigin=eyJpIjoiNDVkMD... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Components: hibernate-orm-modules Created: 24/Mar/2023 05:00 AM Priority: Major Reporter: Robin De Mol ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
See reproducer at . Running the test yields:
org.hibernate.HibernateException: Could not generate fetch : foo.OrganisationUser(o) -> {id}
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7460)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.createFetch(BaseSqmToSqlAstConverter.java:7289)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitIdentifierFetch(BaseSqmToSqlAstConverter.java:7137)
at org.hibernate.sql.results.graph.entity.AbstractEntityResultGraphNode.afterInitialize(AbstractEntityResultGraphNode.java:63)
at org.hibernate.persister.entity.AbstractEntityPersister.createDomainResult(AbstractEntityPersister.java:1217)
at org.hibernate.query.sqm.sql.internal.AbstractSqmPathInterpretation.createDomainResult(AbstractSqmPathInterpretation.java:55)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.lambda$visitSelection$23(BaseSqmToSqlAstConverter.java:2241)
at java.base/java.util.Collections$SingletonList.forEach(Collections.java:4966)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelection(BaseSqmToSqlAstConverter.java:2236)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectClause(BaseSqmToSqlAstConverter.java:2154)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:2022)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:426)
at org.hibernate.query.sqm.tree.select.SqmQuerySpec.accept(SqmQuerySpec.java:122)
at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQueryPart(BaseSemanticQueryWalker.java:221)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQueryPart(BaseSqmToSqlAstConverter.java:1882)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:1567)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:426)
at org.hibernate.query.sqm.tree.select.SqmSelectStatement.accept(SqmSelectStatement.java:222)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.translate(BaseSqmToSqlAstConverter.java:760)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:344)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:267)
at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:243)
at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:521)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:367)
at org.hibernate.query.sqm.internal.QuerySqmImpl.list(QuerySqmImpl.java:1084)
at org.hibernate.query.Query.getResultList(Query.java:119)
at org.hibernate.bugs.JPAUnitTestCase.UnknownTableReferenceException(JPAUnitTestCase.java:55)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.hibernate.HibernateException: Could not generate fetch : foo.OrganisationUser(o).{id}(u) -> organisation
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7460)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.createFetch(BaseSqmToSqlAstConverter.java:7289)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitFetches(BaseSqmToSqlAstConverter.java:7406)
at org.hibernate.sql.results.graph.AbstractFetchParent.afterInitialize(AbstractFetchParent.java:32)
at org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchImpl.<init>(EmbeddableFetchImpl.java:75)
at org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping.generateFetch(AbstractCompositeIdentifierMapping.java:114)
at org.hibernate.sql.results.graph.FetchParent.generateFetchableFetch(FetchParent.java:108)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7449)
... 55 more
Caused by: org.hibernate.sql.ast.tree.from.UnknownTableReferenceException: Unable to determine TableReference (`ORGANISATION_USER`) for `foo.OrganisationUser(o).{id}(u).organisation.{fk}`
at org.hibernate.sql.ast.tree.from.LazyTableGroup.resolveTableReference(LazyTableGroup.java:256)
at org.hibernate.sql.ast.tree.from.DelegatingTableGroup.resolveTableReference(DelegatingTableGroup.java:62)
at org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor.createDomainResult(SimpleForeignKeyDescriptor.java:302)
at org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor.createDomainResult(SimpleForeignKeyDescriptor.java:251)
at org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping.generateFetch(ToOneAttributeMapping.java:1435)
at org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping.generateFetch(ToOneAttributeMapping.java:106)
at org.hibernate.sql.results.graph.FetchParent.generateFetchableFetch(FetchParent.java:108)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.buildFetch(BaseSqmToSqlAstConverter.java:7449)
... 62 more
( https://hibernate.atlassian.net/browse/HHH-16366#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16366#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )
Alina Ricciuti ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61fb92a... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMDBmMzA2ODQx... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16363?atlOrigin=eyJpIjoiMDBmMz... ) HHH-16363 ( https://hibernate.atlassian.net/browse/HHH-16363?atlOrigin=eyJpIjoiMDBmMz... ) OneToMany object properties not set when EmbeddedId and it holds an OneToOne relationship to itself ( https://hibernate.atlassian.net/browse/HHH-16363?atlOrigin=eyJpIjoiMDBmMz... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Created: 23/Mar/2023 04:55 AM Environment: Hibernate: 6.2.0.CR4
Postgresql: 11
Spring Data JPA: 3.0.3
Spring Boot: 3.0.4
JDK: Oracle OpenJDK 17.0.2
OS: Windows 11 Priority: Major Reporter: Alina Ricciuti ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=61fb92a... )
I have a migration issue from hibernate 5.4.32 to hibernate 6: the properties of one of my entities are not properly set. Please find below a simplified model that reproduces this issue.
So, I have Elements and Tags, as presented in the attached diagram:
* Elements have Tags in a relationship ManyToOne , fetch EAGER
* Tags have composite identifiers
* Tag may have a OneToOne relationship “linkedTag”
My sample project is using Lombok / Spring Data :
* Element:
@Entity
@Getter
@Setter
public class Element {
@EmbeddedId
private PkComposite id;
@Column(name = "NAME")
private String name;
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "ID_TAG")
private Tag tag;
}
* Tag:
@Entity
@Getter
@Setter
public class Tag {
@EmbeddedId
private PkComposite id;
private String name;
@OneToMany(mappedBy = "tag", fetch = FetchType.EAGER)
private List<Element> elements;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "ID_TAG_LINKED")
private Tag linkedTag;
}
* The composite key:
@Getter
@Setter
public class PkComposite implements Serializable {
@Column(name = "ID")
private Long id;
public PkComposite withId(Long id) {
this.id = id;
return this;
}
}
* The test class:
@Test
@Transactional
public void issue3_name_not_filled() {
// create some data
Session session = entityManager.unwrap(Session.class);
session.createNativeQuery("insert into TAG (id, NAME) values (100, 'NAME for TAG 100')").executeUpdate();
session.createNativeQuery("insert into ELEMENT (id, NAME, ID_TAG) values (200, 'NAME for ELEMENT 200', 100)").executeUpdate();
// move line to other item
Element element200 = elementRepository.findById(new PkComposite().withId(200L)).orElse(null);
Assertions.assertNotNull(element200);
Assertions.assertNotNull(element200.getTag());
Assertions.assertNotNull(element200.getTag().getName(), "Tag name is null !");
}
The test fails since the name property is not set on Element’s Tag. None of tag’s properties is set, except for its identifier.
Few remarks:
* the issue is reproduced whether the Element identifier is composite or simple (may be Long as example)
* The OneToMany relationship to Element in Tag class may also be lazy - in my project it is actually LAZY with LazyCollection(LazyCollectionOption.FALSE)
* If I remove the “linkedTag” the issue in no longer reproduced
But if I set the “linkedTag“:
@Test
@Transactional
public void issue3_tag_not_properly_set() {
// create some data
Session session = entityManager.unwrap(Session.class);
session.createNativeQuery("insert into TAG (id, NAME) values (101, 'NAME for LINKED TAG 101')").executeUpdate();
session.createNativeQuery("insert into TAG (id, NAME, ID_TAG_LINKED) values (100, 'NAME for TAG 100', 101)").executeUpdate();
session.createNativeQuery("insert into ELEMENT (id, NAME, ID_TAG) values (200, 'NAME for ELEMENT 200', 100)").executeUpdate();
// move line to other item
Element element200 = elementRepository.findById(new PkComposite().withId(200L)).orElse(null);
Assertions.assertNotNull(element200);
Assertions.assertNotNull(element200.getTag());
Assertions.assertNotNull(element200.getTag().getId());
Assertions.assertEquals(100L, element200.getTag().getId().getId(), "Tag is not the good one !");
Assertions.assertEquals("NAME for TAG 100", element200.getTag().getName(), "Tag properties are not good !");
}
The Element’s Tag’s properties are set, but with wrong values, those of the linked Tag.
I have attached the tests logs and if needed, I can also share my sample project.
( https://hibernate.atlassian.net/browse/HHH-16363#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16363#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:0c2c9f2 )
ClementC ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTdmMGMzYTE4... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16360?atlOrigin=eyJpIjoiYTdmMG... ) HHH-16360 ( https://hibernate.atlassian.net/browse/HHH-16360?atlOrigin=eyJpIjoiYTdmMG... ) On Postgresql with hbm2ddl.auto=update, timestamp columns are updated even when correct ( https://hibernate.atlassian.net/browse/HHH-16360?atlOrigin=eyJpIjoiYTdmMG... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Components: hibernate-jpamodelgen Created: 23/Mar/2023 03:52 AM Environment: Postgresql 14 Priority: Major Reporter: ClementC ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
With hbm2ddl.auto=update on Postgresql, columns for properties persisted as timestamps (like Instant, OffsetDateTime, LocalDateTime, …) are updated on every startup, even if the alter statement does not perform any actual change.
hbm2ddl.auto=validate does not detect any problem.
This did not happen on 6.1.7 (because it did not have the capability to update existing columns anyway).
*Sample*
My entity:
@Entity
@Getter
@Setter
public class Test {
@Id
private String id;
private Instant instant;
private OffsetDateTime offsetDateTime;
private ZonedDateTime zonedDateTime;
private LocalDateTime localDateTime;
private Date date;
}
Startup logs (even when columns already exist with the right type):
[Hibernate] alter table if exists auth0.test alter column date set data type timestamp(6)
[Hibernate] alter table if exists auth0.test alter column instant set data type timestamp(6) with time zone
[Hibernate] alter table if exists auth0.test alter column local_date_time set data type timestamp(6)
[Hibernate] alter table if exists auth0.test alter column offset_date_time set data type timestamp(6) with time zone
[Hibernate] alter table if exists auth0.test alter column zoned_date_time set data type timestamp(6) with time zone
*Quick analysis (using 6.2.0.CR4)*
With hbm2ddl.auto=update: StandardTableMigrator#sqlAlterStrings checks both type and length
//StandardTableMigrator line 88
if ( !ColumnDefinitions.hasMatchingType( column, columnInformation, metadata, dialect )
|| !ColumnDefinitions.hasMatchingLength( column, columnInformation, metadata, dialect ) )
With hbm2ddl.auto=validate: AbstractSchemaValidator#validateColumnType only checks the type (which matches)
//AbstractSchemaValidator line 163
if ( !ColumnDefinitions.hasMatchingType( column, columnInformation, metadata, dialect ) ) {
So the problem is in ColumnDefinitions.hasMatchingLength :
final int actualSize = columnInformation.getColumnSize();
if ( actualSize == 0 ) {
return true ;
}
else {
final Size size = column.getColumnSize( dialect, metadata );
final Long requiredLength = size.getLength();
final Integer requiredPrecision = size.getPrecision();
return requiredLength != null && requiredLength == actualSize
|| requiredPrecision != null && requiredPrecision == actualSize
|| requiredPrecision == null && requiredLength == null ;
}
For a timestamp with zone column:
* actualSize = 35 (no idea why)
* requiredLength is null
* requiredPrecision = 6
* ==> requiredPrecision != null && requiredPrecision == actualSize is false
( https://hibernate.atlassian.net/browse/HHH-16360#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16360#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:0c2c9f2 )
Marco Belladelli ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmUwYmIxOTky... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16355?atlOrigin=eyJpIjoiYmUwYm... ) HHH-16355 ( https://hibernate.atlassian.net/browse/HHH-16355?atlOrigin=eyJpIjoiYmUwYm... ) Map association with entity typed key breaks if mappedBy is specified ( https://hibernate.atlassian.net/browse/HHH-16355?atlOrigin=eyJpIjoiYmUwYm... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Marco Belladelli ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480... ) Created: 22/Mar/2023 08:39 AM Priority: Major Reporter: Marco Belladelli ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480... )
In Hibernate 6.2 mapping a Map association with and entity typed key and mappedBy causes an error.
Here is an example mapping:
@Entity
@Table( name = "map_container_entity" )
public static class MapContainerEntity {
@Id
private Long id;
@OneToMany(mappedBy = "container" )
private Map<MapKeyEntity, MapValueEntity> map;
}
@Entity
@Table( name = "map_key_entity" )
public static class MapKeyEntity {
@Id
private Long id;
}
@Entity
@Table( name = "map_value_entity" )
public static class MapValueEntity {
@Id
private Long id;
@ManyToOne
private MapContainerEntity container;
}
And the error is:
Caused by: org.hibernate.MappingException: property [container] not found on entity [com.blazebit.persistence.testsuite.AliasBasedMapKeyDereferencingTest$MapKeyEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:570)
at org.hibernate.boot.model.internal.CollectionBinder.bindUnownedManyToManyInverseForeignKey(CollectionBinder.java:2657)
at org.hibernate.boot.model.internal.CollectionBinder.bindManyToManyInverseForeignKey(CollectionBinder.java:2619)
at org.hibernate.boot.model.internal.MapBinder.handleMapKey(MapBinder.java:184)
at org.hibernate.boot.model.internal.MapBinder.bindKeyFromAssociationTable(MapBinder.java:167)
at org.hibernate.boot.model.internal.MapBinder$1.secondPass(MapBinder.java:95)
at org.hibernate.boot.model.internal.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:45)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1850)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1807)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:324)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1380)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1451)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:142)
at com.blazebit.persistence.testsuite.base.jpa.AbstractJpaPersistenceTest.createEntityManagerFactory(AbstractJpaPersistenceTest.java:848)
... 42 more
Caused by: org.hibernate.MappingException: property [container] not found on entity [com.blazebit.persistence.testsuite.AliasBasedMapKeyDereferencingTest$MapKeyEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:613)
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:566)
... 55 more
( https://hibernate.atlassian.net/browse/HHH-16355#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16355#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:eb3f1fe )
Martin Simka ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMmNjYjg2Y2Q4... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16345?atlOrigin=eyJpIjoiMmNjYj... ) HHH-16345 ( https://hibernate.atlassian.net/browse/HHH-16345?atlOrigin=eyJpIjoiMmNjYj... ) PostgreSQL*ProcedureTest.testProcedureWithJDBCByName fails with EnterpriseDB ( https://hibernate.atlassian.net/browse/HHH-16345?atlOrigin=eyJpIjoiMmNjYj... )
Change By: Martin Simka ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
{{PostgreSQLStoredProcedureTest.testProcedureWithJDBCByName}}
{{PostgreSQLFunctionProcedureTest.testFunctionWithJDBCByName}}
fail with similar error using named parameters:
{noformat} java.lang.AssertionError: expected:<class java.sql.SQLFeatureNotSupportedException> but was:<class com.edb.util.PSQLException>{noformat}
{noformat}com.edb.util.PSQLException: A CallableStatement has a named parameter undefined in the calling statement. Parameter: phoneCount
at com.edb.jdbc.PgCallableStatement.getNamedParameterIndex(PgCallableStatement.java:1152) ~[edb-jdbc-42.5.0.1.jar:42.5.0.1-SNAPSHOT]
at com.edb.jdbc.PgCallableStatement.registerOutParameter(PgCallableStatement.java:831) ~[edb-jdbc-42.5.0.1.jar:42.5.0.1-SNAPSHOT]
at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.lambda$testProcedureWithJDBCByName$5(PostgreSQLStoredProcedureTest.java:221) ~[test/:?]
at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:56) ~[main/:?]
at org.hibernate.internal.AbstractSharedSessionContract.lambda$doReturningWork$6(AbstractSharedSessionContract.java:973) ~[main/:?]
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:290) ~[main/:?]
at org.hibernate.internal.AbstractSharedSessionContract.doWork(AbstractSharedSessionContract.java:977) ~[main/:?]
at org.hibernate.internal.AbstractSharedSessionContract.doReturningWork(AbstractSharedSessionContract.java:973) ~[main/:?]
at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.lambda$testProcedureWithJDBCByName$6(PostgreSQLStoredProcedureTest.java:217) ~[test/:?]
at org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:258) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
at org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:299) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.testProcedureWithJDBCByName(PostgreSQLStoredProcedureTest.java:214) [test/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) [junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.13.2.jar:4.13.2]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) [junit-4.13.2.jar:4.13.2]
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299) [junit-4.13.2.jar:4.13.2]
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293) [junit-4.13.2.jar:4.13.2]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]{noformat}
while {{PostgreSQLFunctionProcedureTest}} could by be fixed by referencing parameters in query
{{sp_count_phones(?,?)}} → {{call sp_count_phones(phoneCount=>?,personId=>?)}}
I didn’t find a similar syntax for {{PostgreSQLFunctionProcedureTest}}.
( https://hibernate.atlassian.net/browse/HHH-16345#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16345#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:eb3f1fe )
Jones ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNzhmYTg1MDVj... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiNzhmYT... ) HHH-16352 ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiNzhmYT... ) DynamicUpdate and Statement/jdbc batch size leads to wrong parameter binding exception ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiNzhmYT... )
Change By: Jones ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Given
* {{STATEMENT_BATCH_SIZE}} is enabled
* An entity with DynamicUpdate
When
* When changing multiple instances of a managed entity
Then
* An exception occurs trying to bind a parameter using the wrong generated sql
{code:java}@DynamicUpdate
@Entity
@Table(name = "ENTITY_A")
public class EntityA {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID")
Integer id;
@Column(name = "PROPERTY_A")
int propertyA;
@Column(name = "PROPERTY_B")
int propertyB;
}{code}
{code:java} @Override
protected void configure(Configuration configuration) {
super.configure(configuration);
configuration.setProperty(AvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.FORMAT_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.STATEMENT_BATCH_SIZE, "2");
}
@Test
public void hhhXXXXTest() throws Exception {
// BaseCoreFunctionalTestCase automatically creates the SessionFactory and
// provides the Session.
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
EntityA entityA1 = new EntityA();
EntityA entityA2 = new EntityA();
s.persist(entityA1);
s.persist(entityA2);
tx.commit();
}
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
String hql = "select e from org.hibernate.bugs.EntityA e";
Query<EntityA> query = s.createQuery(hql, EntityA.class);
List<EntityA> actual = query.list();
actual.get(0).propertyA = 1;
actual.get(1).propertyA = 2;
actual.get(1).propertyB = 2;
s.flush();
tx.commit();
}
}{code}
{noformat}org.hibernate.exception.DataException: Unable to bind parameter #3 - 2 [Invalid value "3" for parameter "parameterIndex" [90008-214]] [n/a]
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:53)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:94)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.lambda$beforeStatement$0(JdbcValueBindingsImpl.java:95)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.hibernate.engine.jdbc.mutation.spi.BindingGroup.forEachBinding(BindingGroup.java:51)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.beforeStatement(JdbcValueBindingsImpl.java:85)
at org.hibernate.engine.jdbc.batch.internal.BatchImpl.lambda$addToBatch$0(BatchImpl.java:129)
at org.hibernate.engine.jdbc.mutation.internal.PreparedStatementGroupSingleTable.forEachStatement(PreparedStatementGroupSingleTable.java:59)
at org.hibernate.engine.jdbc.batch.internal.BatchImpl.addToBatch(BatchImpl.java:114)
at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleBatched.performBatchedOperations(MutationExecutorSingleBatched.java:60)
at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:45)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.doDynamicUpdate(UpdateCoordinatorStandard.java:939)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.performUpdate(UpdateCoordinatorStandard.java:279)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.coordinateUpdate(UpdateCoordinatorStandard.java:209)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2739)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:166)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:616)
at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:487)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:484)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1398)
at org.hibernate.bugs.ORMUnitTestCase.hhhXXXXXTest(ORMUnitTestCase.java:80)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.h2.jdbc.JdbcSQLDataException: Invalid value "3" for parameter "parameterIndex" [90008-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:646)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.getInvalidValueException(DbException.java:298)
at org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:1395)
at org.h2.jdbc.JdbcPreparedStatement.setInt(JdbcPreparedStatement.java:359)
at org.hibernate.type.descriptor.jdbc.IntegerJdbcType$1.doBind(IntegerJdbcType.java:72)
at org.hibernate.type.descriptor.jdbc.BasicBinder.bind(BasicBinder.java:61)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.lambda$beforeStatement$0(JdbcValueBindingsImpl.java:87)
... 38 more
{noformat}
Test scenario to be attached and also available here [https://github.com/ratoaq2/HHH-16352|https://github.com/ratoaq2/HHH-16352...]
( https://hibernate.atlassian.net/browse/HHH-16352#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16352#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:eb3f1fe )
Jones ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMGQ3MzdjN2Rh... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiMGQ3Mz... ) HHH-16352 ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiMGQ3Mz... ) DynamicUpdate and Statement/jdbc batch size leads to wrong parameter binding exception ( https://hibernate.atlassian.net/browse/HHH-16352?atlOrigin=eyJpIjoiMGQ3Mz... )
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Components: hibernate-core Created: 22/Mar/2023 06:03 AM Priority: Critical Reporter: Jones ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Given
* STATEMENT_BATCH_SIZE is enabled
* An entity with DynamicUpdate
When
* When changing multiple instances of a managed entity
Then
* An exception occurs trying to bind a parameter using the wrong generated sql
@DynamicUpdate
@Entity
@Table(name = "ENTITY_A" )
public class EntityA {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID" )
Integer id;
@Column(name = "PROPERTY_A" )
int propertyA;
@Column(name = "PROPERTY_B" )
int propertyB;
}
@Override
protected void configure(Configuration configuration) {
super.configure(configuration);
configuration.setProperty(AvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.FORMAT_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.STATEMENT_BATCH_SIZE, "2" );
}
@Test
public void hhhXXXXTest() throws Exception {
// BaseCoreFunctionalTestCase automatically creates the SessionFactory and
// provides the Session.
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
EntityA entityA1 = new EntityA();
EntityA entityA2 = new EntityA();
s.persist(entityA1);
s.persist(entityA2);
tx.commit();
}
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
String hql = "select e from org.hibernate.bugs.EntityA e" ;
Query<EntityA> query = s.createQuery(hql, EntityA.class);
List<EntityA> actual = query.list();
actual.get(0).propertyA = 1;
actual.get(1).propertyA = 2;
actual.get(1).propertyB = 2;
s.flush();
tx.commit();
}
}
org.hibernate.exception.DataException: Unable to bind parameter #3 - 2 [Invalid value "3" for parameter "parameterIndex" [90008-214]] [n/a]
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:53)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:94)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.lambda$beforeStatement$0(JdbcValueBindingsImpl.java:95)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.hibernate.engine.jdbc.mutation.spi.BindingGroup.forEachBinding(BindingGroup.java:51)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.beforeStatement(JdbcValueBindingsImpl.java:85)
at org.hibernate.engine.jdbc.batch.internal.BatchImpl.lambda$addToBatch$0(BatchImpl.java:129)
at org.hibernate.engine.jdbc.mutation.internal.PreparedStatementGroupSingleTable.forEachStatement(PreparedStatementGroupSingleTable.java:59)
at org.hibernate.engine.jdbc.batch.internal.BatchImpl.addToBatch(BatchImpl.java:114)
at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleBatched.performBatchedOperations(MutationExecutorSingleBatched.java:60)
at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:45)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.doDynamicUpdate(UpdateCoordinatorStandard.java:939)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.performUpdate(UpdateCoordinatorStandard.java:279)
at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.coordinateUpdate(UpdateCoordinatorStandard.java:209)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2739)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:166)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:616)
at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:487)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:484)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1398)
at org.hibernate.bugs.ORMUnitTestCase.hhhXXXXXTest(ORMUnitTestCase.java:80)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.h2.jdbc.JdbcSQLDataException: Invalid value "3" for parameter "parameterIndex" [90008-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:646)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.getInvalidValueException(DbException.java:298)
at org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:1395)
at org.h2.jdbc.JdbcPreparedStatement.setInt(JdbcPreparedStatement.java:359)
at org.hibernate.type.descriptor.jdbc.IntegerJdbcType$1.doBind(IntegerJdbcType.java:72)
at org.hibernate.type.descriptor.jdbc.BasicBinder.bind(BasicBinder.java:61)
at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.lambda$beforeStatement$0(JdbcValueBindingsImpl.java:87)
... 38 more
Test scenario to be attached
( https://hibernate.atlassian.net/browse/HHH-16352#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16352#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:eb3f1fe )