Skip to content

Commit af81679

Browse files
Add missing constructor hint required by hibernate PostgreSQLDialect
This commit fixes an issue where the PostgreSQLDialect contributes types to the hibernate configuration that require reflective access to the org.postgresql.util.PGobject constructor which caused: java.lang.NoSuchMethodException: org.postgresql.util.PGobject.<init>() at [email protected]/java.lang.Class.getConstructor0(DynamicHub.java:3585) at [email protected]/java.lang.Class.getConstructor(DynamicHub.java:2271) at org.hibernate.dialect.PostgreSQLPGObjectJdbcType.<clinit>(PostgreSQLPGObjectJdbcType.java:50) at org.hibernate.dialect.PostgreSQLDialect.registerColumnTypes(PostgreSQLDialect.java:231) at org.hibernate.dialect.Dialect.contributeTypes(Dialect.java:1341) at org.hibernate.dialect.PostgreSQLDialect.contributeTypes(PostgreSQLDialect.java:1229) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:386) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:143) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421) Closes #131
1 parent 89bcfe4 commit af81679

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

metadata/org.hibernate.orm/hibernate-core/6.1.1.Final/reflect-config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11728,7 +11728,13 @@
1172811728
"typeReachable": "org.postgresql.Driver"
1172911729
},
1173011730
"name": "org.postgresql.util.PGobject",
11731-
"queryAllDeclaredMethods": true
11731+
"queryAllDeclaredMethods": true,
11732+
"methods": [
11733+
{
11734+
"name": "<init>",
11735+
"parameterTypes": []
11736+
}
11737+
]
1173211738
},
1173311739
{
1173411740
"condition": {

tests/src/org.hibernate.orm/hibernate-core/6.1.1.Final/src/test/java/org/hibernate/orm/HibernateOrmTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.hibernate.annotations.TenantId;
2929
import org.hibernate.annotations.UpdateTimestamp;
3030
import org.hibernate.annotations.ValueGenerationType;
31+
import org.hibernate.boot.model.TypeContributions;
3132
import org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl;
3233
import org.hibernate.boot.registry.selector.internal.StrategySelectorImpl;
3334
import org.hibernate.boot.registry.selector.spi.StrategySelector;
@@ -48,6 +49,7 @@
4849
import org.hibernate.tuple.GenerationTiming;
4950
import org.hibernate.tuple.TenantIdGeneration;
5051
import org.hibernate.tuple.ValueGenerator;
52+
import org.hibernate.type.spi.TypeConfiguration;
5153
import org.junit.jupiter.api.Test;
5254

5355
public class HibernateOrmTest {
@@ -175,6 +177,21 @@ void postgreSqlDialect() {
175177
assertNotNull(dialectFactory.buildDialect(Collections.singletonMap(AvailableSettings.DIALECT, "org.hibernate.dialect.PostgreSQLDialect"), () -> StubDialectResolutionInfo.INSTANCE));
176178
}
177179

180+
@Test
181+
void initPostgresqlDialect() {
182+
183+
TypeContributions contributions = new TypeContributions() {
184+
TypeConfiguration configuration = new TypeConfiguration();
185+
@Override
186+
public TypeConfiguration getTypeConfiguration() {
187+
return configuration;
188+
}
189+
};
190+
191+
ServiceRegistry registry = new StubServiceRegistryImplementor();
192+
new org.hibernate.dialect.PostgreSQLDialect().contributeTypes(contributions, registry);
193+
}
194+
178195
@Test
179196
void testGeneratedAnnotation() throws InstantiationException, IllegalAccessException {
180197

0 commit comments

Comments
 (0)