HHH-17460 - Ongoing JPA 32 work

This commit is contained in:
Steve Ebersole 2024-03-26 17:57:38 -05:00
parent cda6b2c2a6
commit 7d9b425a89
1 changed files with 23 additions and 19 deletions

View File

@ -24,25 +24,11 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Sharath Reddy
*/
@DomainModel( annotatedClasses = {
Menu.class,
FoodItem.class,
Company.class,
Person.class,
Message.class,
Language.class,
Contract.class,
ContractId.class,
Model.class,
ModelId.class,
Manufacturer.class,
ManufacturerId.class,
Product.class,
ProductSqlServer.class
} )
@SessionFactory
@SuppressWarnings("JUnitMalformedDeclaration")
public class ManyToOneWithFormulaTest {
@Test
@DomainModel( annotatedClasses = { Menu.class, FoodItem.class } )
@SessionFactory
public void testManyToOneFromNonPk(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
Menu menu = new Menu();
@ -65,6 +51,8 @@ public class ManyToOneWithFormulaTest {
}
@Test
@DomainModel( annotatedClasses = { Company.class, Person.class } )
@SessionFactory
public void testManyToOneFromPk(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
Company company = new Company();
@ -87,6 +75,8 @@ public class ManyToOneWithFormulaTest {
}
@Test
@DomainModel( annotatedClasses = { Message.class, Language.class } )
@SessionFactory
@SkipForDialect( dialectClass = HSQLDialect.class, reason = "The used join conditions does not work in HSQLDB. See HHH-4497" )
public void testManyToOneToPkWithOnlyFormula(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
@ -112,11 +102,21 @@ public class ManyToOneWithFormulaTest {
}
@Test
@DomainModel( annotatedClasses = {
Contract.class,
ContractId.class,
Model.class,
ModelId.class,
Manufacturer.class,
ManufacturerId.class,
} )
@SessionFactory
public void testReferencedColumnNameBelongsToEmbeddedIdOfReferencedEntity(SessionFactoryScope scope) {
scope.inTransaction( (session) -> { Integer companyCode = 10;
scope.inTransaction( (session) -> {
Integer companyCode = 10;
Integer mfgCode = 100;
String contractNumber = "NSAR97841";
ContractId contractId = new ContractId(companyCode, 12457l, 1);
ContractId contractId = new ContractId(companyCode, 12457L, 1);
Manufacturer manufacturer = new Manufacturer(new ManufacturerId(
companyCode, mfgCode), "FORD");
@ -148,6 +148,8 @@ public class ManyToOneWithFormulaTest {
}
@Test
@DomainModel( annotatedClasses = Product.class )
@SessionFactory
@SkipForDialect( dialectClass =HSQLDialect.class, reason = "The used join conditions does not work in HSQLDB. See HHH-4497." )
@SkipForDialect( dialectClass = OracleDialect.class, reason = "Oracle do not support 'substring' function" )
@SkipForDialect( dialectClass = AltibaseDialect.class, reason = " Altibase char type returns with trailing spaces")
@ -185,6 +187,8 @@ public class ManyToOneWithFormulaTest {
}
@Test
@DomainModel( annotatedClasses = ProductSqlServer.class )
@SessionFactory
@RequiresDialect( SQLServerDialect.class )
public void testManyToOneFromNonPkToNonPkSqlServer(SessionFactoryScope scope) {
// also tests usage of the stand-alone @JoinFormula annotation