Skip to content

Commit

Permalink
JBIDE-29214: Update hibernate tools dependency of org.jboss.tools.hib…
Browse files Browse the repository at this point in the history
…ernate.orm.runtime.v_7_0 to version 7.0.0.Alpha3

Signed-off-by: Koen Aers <[email protected]>
  • Loading branch information
koentsje committed Aug 1, 2024
1 parent 8d42621 commit 43bcf10
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<packaging>eclipse-plugin</packaging>

<properties>
<hibernate.version>7.0.0.Alpha2</hibernate.version>
<hibernate.models.version>0.8.3</hibernate.models.version>
<hibernate.version>7.0.0.Alpha3</hibernate.version>
<hibernate.models.version>0.8.5</hibernate.models.version>
<bytebuddy.version>1.14.15</bytebuddy.version>
<jakarta-persistence-api.version>3.2.0</jakarta-persistence-api.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,7 +49,7 @@ public void testGetDialect() {

@Test
public void testGetDataSource() {
assertEquals("hibernate.connection.datasource", environmentFacade.getDataSource());
assertEquals("jakarta.persistence.jtaDataSource", environmentFacade.getDataSource());
}

@Test
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,7 +43,7 @@ public void testColumnName() {

@Test
public void testPropertyToColumnName() {
assertEquals("BarFooPropertyColumn", namingStrategyFacade.propertyToColumnName("bar"));
assertEquals("FooBarColumnName", namingStrategyFacade.propertyToColumnName("bar"));
}

@Test
Expand All @@ -53,45 +58,32 @@ public void testJoinKeyColumnName() {

@Test
public void testClassToTableName() {
assertEquals("FooBarClassTable", namingStrategyFacade.classToTableName("foobar"));
assertEquals("BarFooTable", namingStrategyFacade.classToTableName("foobar"));
}

@Test
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");
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -231,15 +231,15 @@ 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();
assertNotNull(target);
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43bcf10

Please sign in to comment.