From 43bcf10b84eaf8b65bfc073701e06dceb07d5d2c Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Thu, 1 Aug 2024 14:38:42 +0300 Subject: [PATCH] JBIDE-29214: Update hibernate tools dependency of org.jboss.tools.hibernate.orm.runtime.v_7_0 to version 7.0.0.Alpha3 Signed-off-by: Koen Aers --- .../META-INF/MANIFEST.MF | 12 ++--- .../pom.xml | 4 +- .../orm/runtime/v_7_0/IConfigurationTest.java | 10 ++-- .../orm/runtime/v_7_0/IEnvironmentTest.java | 10 ++-- .../runtime/v_7_0/INamingStrategyTest.java | 48 ++++++++----------- .../orm/runtime/v_7_0/ITypeTest.java | 2 +- .../orm/runtime/v_7_0/ServiceImplTest.java | 8 ++-- .../orm/runtime/v_7_0/VersionTest.java | 4 +- 8 files changed, 45 insertions(+), 53 deletions(-) diff --git a/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/META-INF/MANIFEST.MF b/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/META-INF/MANIFEST.MF index 2a4ed3eee4..343c572fcb 100644 --- a/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/META-INF/MANIFEST.MF +++ b/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/META-INF/MANIFEST.MF @@ -18,11 +18,11 @@ Require-Bundle: org.jboss.tools.hibernate.orm.runtime.common, Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ClassPath: ., - lib/hibernate-ant-7.0.0.Alpha2.jar, - lib/hibernate-core-7.0.0.Alpha2.jar, - lib/hibernate-tools-orm-7.0.0.Alpha2.jar, - lib/hibernate-tools-orm-jbt-7.0.0.Alpha2.jar, - lib/hibernate-tools-utils-7.0.0.Alpha2.jar, - lib/hibernate-models-0.8.3.jar, + lib/hibernate-ant-7.0.0.Alpha3.jar, + lib/hibernate-core-7.0.0.Alpha3.jar, + lib/hibernate-tools-orm-7.0.0.Alpha3.jar, + lib/hibernate-tools-orm-jbt-7.0.0.Alpha3.jar, + lib/hibernate-tools-utils-7.0.0.Alpha3.jar, + lib/hibernate-models-0.8.5.jar, lib/byte-buddy-1.14.15.jar, lib/jakarta.persistence-api-3.2.0.jar diff --git a/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/pom.xml b/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/pom.xml index b897eda5b1..32245d4ec3 100644 --- a/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/pom.xml +++ b/orm/plugin/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0/pom.xml @@ -12,8 +12,8 @@ eclipse-plugin - 7.0.0.Alpha2 - 0.8.3 + 7.0.0.Alpha3 + 0.8.5 1.14.15 3.2.0 diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IConfigurationTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IConfigurationTest.java index e23bccc129..5bb3d04781 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IConfigurationTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IConfigurationTest.java @@ -29,9 +29,9 @@ import org.hibernate.boot.Metadata; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.jaxb.spi.Binding; +import org.hibernate.boot.model.naming.ImplicitNamingStrategy; +import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; import org.hibernate.cfg.AvailableSettings; -import org.hibernate.cfg.DefaultNamingStrategy; -import org.hibernate.cfg.NamingStrategy; import org.hibernate.mapping.PersistentClass; import org.hibernate.tool.api.reveng.RevengStrategy; import org.hibernate.tool.orm.jbt.api.factory.WrapperFactory; @@ -269,11 +269,11 @@ public void testSetEntityResolver() throws Exception { public void testSetNamingStrategy() throws Exception { INamingStrategy namingStrategyFacade = (INamingStrategy)GenericFacadeFactory.createFacade( INamingStrategy.class, - WrapperFactory.createNamingStrategyWrapper(DefaultNamingStrategy.class.getName())); + WrapperFactory.createNamingStrategyWrapper(ImplicitNamingStrategyJpaCompliantImpl.class.getName())); // For native configuration Field namingStrategyField = nativeConfigurationTarget.getClass().getDeclaredField("namingStrategy"); namingStrategyField.setAccessible(true); - NamingStrategy namingStrategyTarget = (NamingStrategy)((Wrapper)((IFacade)namingStrategyFacade).getTarget()).getWrappedObject(); + ImplicitNamingStrategy namingStrategyTarget = (ImplicitNamingStrategy)((Wrapper)((IFacade)namingStrategyFacade).getTarget()).getWrappedObject(); assertNull(namingStrategyField.get(nativeConfigurationTarget)); nativeConfigurationFacade.setNamingStrategy(namingStrategyFacade); assertNotNull(namingStrategyField.get(nativeConfigurationTarget)); @@ -772,7 +772,7 @@ public void testGetClassMapping() throws Exception { @Test public void testGetNamingStrategy() { // For native configuration - NamingStrategy namingStrategy = new DefaultNamingStrategy(); + ImplicitNamingStrategy namingStrategy = new ImplicitNamingStrategyJpaCompliantImpl(); assertNull(nativeConfigurationFacade.getNamingStrategy()); nativeConfigurationTarget.setNamingStrategy(namingStrategy); INamingStrategy namingStrategyFacade = nativeConfigurationFacade.getNamingStrategy(); diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IEnvironmentTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IEnvironmentTest.java index d21f34ef05..4c4b2b72a7 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IEnvironmentTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/IEnvironmentTest.java @@ -34,7 +34,7 @@ public void testGetTransactionManagerStrategy() { @Test public void testGetDriver() { - assertEquals("hibernate.connection.driver_class", environmentFacade.getDriver()); + assertEquals("jakarta.persistence.jdbc.driver", environmentFacade.getDriver()); } @Test @@ -49,7 +49,7 @@ public void testGetDialect() { @Test public void testGetDataSource() { - assertEquals("hibernate.connection.datasource", environmentFacade.getDataSource()); + assertEquals("jakarta.persistence.jtaDataSource", environmentFacade.getDataSource()); } @Test @@ -59,17 +59,17 @@ public void testGetConnectionProvider() { @Test public void testGetURL() { - assertEquals("hibernate.connection.url", environmentFacade.getURL()); + assertEquals("jakarta.persistence.jdbc.url", environmentFacade.getURL()); } @Test public void testGetUser() { - assertEquals("hibernate.connection.username", environmentFacade.getUser()); + assertEquals("jakarta.persistence.jdbc.user", environmentFacade.getUser()); } @Test public void testGetPass() { - assertEquals("hibernate.connection.password", environmentFacade.getPass()); + assertEquals("jakarta.persistence.jdbc.password", environmentFacade.getPass()); } @Test diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/INamingStrategyTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/INamingStrategyTest.java index 05f28e0a35..e05fc6e1b2 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/INamingStrategyTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/INamingStrategyTest.java @@ -2,7 +2,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.hibernate.cfg.DefaultNamingStrategy; +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.boot.model.naming.ImplicitBasicColumnNameSource; +import org.hibernate.boot.model.naming.ImplicitCollectionTableNameSource; +import org.hibernate.boot.model.naming.ImplicitEntityNameSource; +import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; +import org.hibernate.boot.model.naming.ImplicitPrimaryKeyJoinColumnNameSource; import org.hibernate.tool.orm.jbt.api.factory.WrapperFactory; import org.jboss.tools.hibernate.orm.runtime.common.GenericFacadeFactory; import org.jboss.tools.hibernate.runtime.spi.INamingStrategy; @@ -38,7 +43,7 @@ public void testColumnName() { @Test public void testPropertyToColumnName() { - assertEquals("BarFooPropertyColumn", namingStrategyFacade.propertyToColumnName("bar")); + assertEquals("FooBarColumnName", namingStrategyFacade.propertyToColumnName("bar")); } @Test @@ -53,7 +58,7 @@ public void testJoinKeyColumnName() { @Test public void testClassToTableName() { - assertEquals("FooBarClassTable", namingStrategyFacade.classToTableName("foobar")); + assertEquals("BarFooTable", namingStrategyFacade.classToTableName("foobar")); } @Test @@ -61,37 +66,24 @@ public void testGetStrategyClassName() { assertEquals(TestNamingStrategy.class.getName(), namingStrategyFacade.getStrategyClassName()); } - public static class TestNamingStrategy extends DefaultNamingStrategy { - private static final long serialVersionUID = 1L; - @Override - public String collectionTableName( - String ownerEntity, - String ownerEntityTable, - String associatedEntity, - String associatedEntityTable, - String propertyName) { - return "FooBarCollectionTableName"; - } - @Override - public String columnName(String columnName) { - return "FooBarColumnName"; + @SuppressWarnings("serial") + public static class TestNamingStrategy extends ImplicitNamingStrategyJpaCompliantImpl { + @Override + public Identifier determineCollectionTableName(ImplicitCollectionTableNameSource source) { + return Identifier.toIdentifier("FooBarCollectionTableName"); } @Override - public String propertyToColumnName(String propertyName) { - return "BarFooPropertyColumn"; + public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source) { + return Identifier.toIdentifier("FooBarColumnName"); } @Override - public String tableName(String tableName) { - return "BarFooTable"; + public Identifier determinePrimaryTableName(ImplicitEntityNameSource source) { + return Identifier.toIdentifier("BarFooTable"); } @Override - public String joinKeyColumnName(String joinedColumn, String joinedTable) { - return "FooBarJoinKeyColumnName"; - } - @Override - public String classToTableName(String className) { - return "FooBarClassTable"; + public Identifier determinePrimaryKeyJoinColumnName(ImplicitPrimaryKeyJoinColumnNameSource source) { + return Identifier.toIdentifier("FooBarJoinKeyColumnName"); } } - + } diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ITypeTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ITypeTest.java index 900b7a3aaf..09b10934e8 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ITypeTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ITypeTest.java @@ -164,7 +164,7 @@ public void testIsComponentType() { component.setComponentClassName("java.lang.Object"); IType componentTypeFacade = (IType)GenericFacadeFactory.createFacade( IType.class, - TypeWrapperFactory.createTypeWrapper(new ComponentType(component, null, null))); + TypeWrapperFactory.createTypeWrapper(new ComponentType(component, null))); assertTrue(componentTypeFacade.isComponentType()); } diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ServiceImplTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ServiceImplTest.java index 690b6dc100..351f0cd157 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ServiceImplTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/ServiceImplTest.java @@ -14,11 +14,11 @@ import java.util.List; import java.util.Properties; +import org.hibernate.boot.model.naming.ImplicitNamingStrategy; +import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.DefaultNamingStrategy; import org.hibernate.cfg.Environment; -import org.hibernate.cfg.NamingStrategy; import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl; import org.hibernate.mapping.Array; import org.hibernate.mapping.Bag; @@ -231,7 +231,7 @@ public void testNewTypeFactory() { @Test public void testNewNamingStrategy() { - String strategyClassName = DefaultNamingStrategy.class.getName(); + String strategyClassName = ImplicitNamingStrategyJpaCompliantImpl.class.getName(); INamingStrategy namingStrategy = service.newNamingStrategy(strategyClassName); assertNotNull(namingStrategy); Object target = ((IFacade)namingStrategy).getTarget(); @@ -239,7 +239,7 @@ public void testNewNamingStrategy() { assertTrue(target instanceof Wrapper); target = ((Wrapper)target).getWrappedObject(); assertNotNull(target); - assertTrue(NamingStrategy.class.isAssignableFrom(target.getClass())); + assertTrue(ImplicitNamingStrategy.class.isAssignableFrom(target.getClass())); namingStrategy = null; assertNull(namingStrategy); try { diff --git a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/VersionTest.java b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/VersionTest.java index 80e0bbbe1a..e1466cb960 100644 --- a/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/VersionTest.java +++ b/orm/test/runtime/org.jboss.tools.hibernate.orm.runtime.v_7_0.test/src/org/jboss/tools/hibernate/orm/runtime/v_7_0/VersionTest.java @@ -11,12 +11,12 @@ public class VersionTest { @Test public void testCoreVersion() { - assertEquals("7.0.0.Alpha2", org.hibernate.Version.getVersionString()); + assertEquals("7.0.0.Alpha3", org.hibernate.Version.getVersionString()); } @Test public void testToolsVersion() { - assertEquals("7.0.0.Alpha2", org.hibernate.tool.api.version.Version.CURRENT_VERSION); + assertEquals("7.0.0.Alpha3", org.hibernate.tool.api.version.Version.CURRENT_VERSION); } @Test