Skip to content

Commit bdd719b

Browse files
authored
Additional metadata for org.hibernate.orm:hibernate-core:6.2.0.Final (#274)
* Added more metadata for org.hibernate.orm:hibernate-core:6.2.0.Final * Added more metadata for org.hibernate.orm:hibernate-core:6.2.0.Final * Added copyright
1 parent be90554 commit bdd719b

File tree

5 files changed

+124
-6
lines changed

5 files changed

+124
-6
lines changed

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

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@
119119
"condition":{"typeReachable":"org.hibernate.sql.results.spi.LoadContexts"},
120120
"name":"[Lorg.hibernate.sql.results.jdbc.spi.JdbcValuesSourceProcessingState;"
121121
},
122+
{
123+
"condition":{"typeReachable":"org.hibernate.boot.beanvalidation.BeanValidationIntegrator"},
124+
"name":"jakarta.validation.ConstraintViolation"
125+
},
126+
{
127+
"condition":{"typeReachable":"org.hibernate.dialect.OracleJdbcHelper"},
128+
"name":"oracle.jdbc.OracleConnection"
129+
},
130+
{
131+
"condition":{"typeReachable":"org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl"},
132+
"name":"org.h2.Driver",
133+
"methods":[{"name":"<init>","parameterTypes":[] }]
134+
},
122135
{
123136
"condition":{"typeReachable":"org.hibernate.boot.beanvalidation.BeanValidationIntegrator"},
124137
"name":"org.hibernate.boot.beanvalidation.TypeSafeActivator",
@@ -134,11 +147,21 @@
134147
"name":"org.hibernate.boot.internal.DefaultSessionFactoryBuilderService",
135148
"queryAllPublicMethods":true
136149
},
150+
{
151+
"condition":{"typeReachable":"org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl"},
152+
"name":"org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy",
153+
"methods":[{"name":"<init>","parameterTypes":[] }]
154+
},
137155
{
138156
"condition":{"typeReachable":"org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$1"},
139157
"name":"org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl",
140158
"methods":[{"name":"<init>","parameterTypes":[] }]
141159
},
160+
{
161+
"condition":{"typeReachable":"org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl"},
162+
"name":"org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
163+
"methods":[{"name":"<init>","parameterTypes":[] }]
164+
},
142165
{
143166
"condition":{"typeReachable":"org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$2"},
144167
"name":"org.hibernate.boot.model.relational.ColumnOrderingStrategyStandard",
@@ -476,6 +499,11 @@
476499
"name":"org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer",
477500
"methods":[{"name":"<init>","parameterTypes":["java.lang.Class","int"] }]
478501
},
502+
{
503+
"condition":{"typeReachable":"org.hibernate.id.enhanced.TableGenerator"},
504+
"name":"org.hibernate.id.enhanced.LegacyNamingStrategy",
505+
"methods":[{"name":"<init>","parameterTypes":[] }]
506+
},
479507
{
480508
"condition":{"typeReachable":"org.hibernate.id.enhanced.OptimizerFactory"},
481509
"name":"org.hibernate.id.enhanced.NoopOptimizer",
@@ -501,6 +529,11 @@
501529
"name":"org.hibernate.id.enhanced.SequenceStyleGenerator",
502530
"methods":[{"name":"<init>","parameterTypes":[] }]
503531
},
532+
{
533+
"condition":{"typeReachable":"org.hibernate.id.enhanced.TableGenerator"},
534+
"name":"org.hibernate.id.enhanced.SingleNamingStrategy",
535+
"methods":[{"name":"<init>","parameterTypes":[] }]
536+
},
504537
{
505538
"condition":{"typeReachable":"org.hibernate.id.enhanced.TableGenerator"},
506539
"name":"org.hibernate.id.enhanced.StandardNamingStrategy",
@@ -721,6 +754,11 @@
721754
"name":"org.hibernate.internal.log.DeprecationLogger_$logger",
722755
"methods":[{"name":"<init>","parameterTypes":["org.jboss.logging.Logger"] }]
723756
},
757+
{
758+
"condition":{"typeReachable":"org.hibernate.internal.log.IncubationLogger"},
759+
"name":"org.hibernate.internal.log.IncubationLogger_$logger",
760+
"methods":[{"name":"<init>","parameterTypes":["org.jboss.logging.Logger"] }]
761+
},
724762
{
725763
"condition":{"typeReachable":"org.hibernate.internal.log.UrlMessageBundle"},
726764
"name":"org.hibernate.internal.log.UrlMessageBundle_$logger",
@@ -832,13 +870,17 @@
832870
"queryAllPublicMethods":true
833871
},
834872
{
835-
"condition":{"typeReachable":"org.hibernate.tool.schema.internal.SchemaCreatorImpl"},
873+
"condition":{"typeReachable":"org.hibernate.tool.schema.internal.SchemaDropperImpl"},
836874
"name":"org.hibernate.tool.schema.internal.script.SingleLineSqlScriptExtractor",
837875
"queryAllPublicMethods":true
838876
},
839877
{
840878
"condition":{"typeReachable":"org.hibernate.type.descriptor.JdbcTypeNameMapper"},
841879
"name":"org.hibernate.type.SqlTypes",
842880
"allPublicFields":true
881+
},
882+
{
883+
"condition":{"typeReachable":"org.hibernate.dialect.PgJdbcHelper"},
884+
"name":"org.postgresql.util.PGobject"
843885
}
844886
]

tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/generate-metadata.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
./gradlew test --tests "org_hibernate_orm.hibernate_core.UrlMessageBundleTest" -Pagent metadataCopy
1212
./gradlew test --tests "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest" -Pagent metadataCopy
1313
./gradlew test --tests "org_hibernate_orm.hibernate_core.OptimizerTest" -Pagent metadataCopy
14+
./gradlew test --tests "org_hibernate_orm.hibernate_core.EntityManagerTest" -Pagent metadataCopy
1415
./gradlew updateGeneratedMetadata

tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/metadata-extra-filter.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
22
"rules": [
3-
{"excludeClasses": "**"},
4-
{"includeClasses": "org.hibernate.**"},
5-
{"includeClasses": "[Lorg.hibernate.**"},
6-
{"includeClasses": "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest"}
3+
{"includeClasses": "**"},
4+
{"excludeClasses": "[Ljava.util.**"},
5+
{"excludeClasses": "ch.qos.**"},
6+
{"excludeClasses": "com.sun.**"},
7+
{"excludeClasses": "java.**"},
8+
{"excludeClasses": "org.slf4j.**"},
9+
{"excludeClasses": "org_hibernate_orm.hibernate_core.entity.**"},
10+
{"excludeClasses": "sun.security.**"}
711
],
812
"regexRules": [
913
{"excludeClasses": "org\\.hibernate.*_\\$logger_en.*"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
package org_hibernate_orm.hibernate_core;
8+
9+
import jakarta.persistence.EntityManager;
10+
import jakarta.persistence.EntityManagerFactory;
11+
import jakarta.persistence.Persistence;
12+
import org.hibernate.cfg.AvailableSettings;
13+
import org.junit.jupiter.api.AfterAll;
14+
import org.junit.jupiter.api.TestInstance;
15+
import org.junit.jupiter.params.ParameterizedTest;
16+
import org.junit.jupiter.params.provider.ValueSource;
17+
18+
import java.util.HashMap;
19+
import java.util.Map;
20+
21+
import static org.assertj.core.api.Assertions.assertThat;
22+
23+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
24+
public class EntityManagerTest {
25+
26+
private EntityManagerFactory entityManagerFactory;
27+
private EntityManager entityManager;
28+
29+
@AfterAll
30+
public void close() {
31+
if (entityManager != null) {
32+
entityManager.close();
33+
entityManager = null;
34+
}
35+
if (entityManagerFactory != null) {
36+
entityManagerFactory.close();
37+
entityManagerFactory = null;
38+
}
39+
}
40+
41+
@ParameterizedTest
42+
@ValueSource(strings = {
43+
"single",
44+
"legacy",
45+
"standard"})
46+
public void testLoadDbStructureNamingStrategy(String namingStrategy) {
47+
Map<String, String> properties = new HashMap<>();
48+
properties.put(AvailableSettings.ID_DB_STRUCTURE_NAMING_STRATEGY, namingStrategy);
49+
createEntityManager(properties);
50+
assertThat(entityManager).isNotNull();
51+
}
52+
53+
@ParameterizedTest
54+
@ValueSource(strings = {
55+
"org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
56+
"org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy"})
57+
public void testLoadPhysicalNamingStrategy(String physicalNamingStrategy) {
58+
Map<String, String> properties = new HashMap<>();
59+
properties.put(AvailableSettings.PHYSICAL_NAMING_STRATEGY, physicalNamingStrategy);
60+
createEntityManager(properties);
61+
assertThat(entityManager).isNotNull();
62+
}
63+
64+
private void createEntityManager(Map<String, String> properties) {
65+
properties.put("jakarta.persistence.jdbc.url", "jdbc:h2:mem:test;MODE=MYSQL");
66+
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
67+
entityManagerFactory = Persistence.createEntityManagerFactory("StudentPU", properties);
68+
entityManager = entityManagerFactory.createEntityManager();
69+
}
70+
71+
}

tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/src/test/resources/META-INF/persistence.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<property name="jakarta.persistence.jdbc.driver" value="org.h2.Driver" />
1212
<property name="jakarta.persistence.jdbc.user" value="" />
1313
<property name="jakarta.persistence.jdbc.password" value="" />
14-
<property name="hibernate.hbm2ddl.auto" value="create-only" />
14+
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
1515
<property name="show_sql" value="true"/>
1616
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
1717
</properties>

0 commit comments

Comments
 (0)