Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
19a9600
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 10, 2025
cefb148
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
c561728
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
be2eb03
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
7bc9af2
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
5bcec00
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
f4de232
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
b1499c4
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
5c89a4c
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
94937a2
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
fd5ce7a
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
43aded5
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 13, 2025
cf1ba89
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 14, 2025
03baaae
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 14, 2025
905c0a6
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 14, 2025
96fd295
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 15, 2025
c0ae789
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 15, 2025
0d7b650
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
6f809ca
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
968a2e2
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
a2ab1fa
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
b3d21a8
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
2fa844a
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 16, 2025
53f40eb
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 17, 2025
be28410
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 17, 2025
cc13974
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 17, 2025
0ca1984
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 17, 2025
f7d649c
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 19, 2025
4cf9369
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 19, 2025
c36d5f3
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
ceb9522
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
652896f
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
e0be515
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
4dd3899
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
7f4c320
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
d627207
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
224ddfd
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
4451d08
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
3cd466e
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
1a8a81f
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 20, 2025
01e4ca3
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
a8fba61
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
e0c88c3
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
3091bb1
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
3b1277b
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
3773367
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 21, 2025
ebd4a7c
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 22, 2025
f4be7d5
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 22, 2025
fc47685
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 22, 2025
74d39d5
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 22, 2025
18f7793
HHH-19846 Drop JUnit 4 usage
dreab8 Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.annotations;

import java.io.Serializable;
import java.util.Collection;
import java.util.SortedSet;
Expand Down Expand Up @@ -31,7 +32,7 @@ public class Customer implements Serializable {
Long id;
String name;
SortedSet<Ticket> tickets;
Collection discountTickets;
Collection<Discount> discountTickets;
Passport passport;

public Customer() {
Expand Down Expand Up @@ -69,11 +70,11 @@ public void setTickets(SortedSet<Ticket> tickets) {
@OneToMany(targetEntity = Discount.class,
cascade = CascadeType.ALL, mappedBy = "owner")
@Cascade({ALL})
public Collection getDiscountTickets() {
public Collection<Discount> getDiscountTickets() {
return discountTickets;
}

public void setDiscountTickets(Collection collection) {
public void setDiscountTickets(Collection<Discount> collection) {
discountTickets = collection;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.annotations;

import java.io.Serializable;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.annotations;

import java.io.Serializable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.orm.test.annotations;

import java.io.Serializable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down Expand Up @@ -43,13 +44,9 @@ public void setNumber(String string) {

public boolean equals(Object o) {
if ( this == o ) return true;
if ( !( o instanceof Ticket ) ) return false;

final Ticket ticket = (Ticket) o;

if ( !number.equals( ticket.number ) ) return false;
if ( !(o instanceof Ticket ticket) ) return false;

return true;
return number.equals( ticket.number );
}

public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@
import org.hibernate.boot.registry.BootstrapServiceRegistry;
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.orm.junit.BaseUnitTest;
import org.junit.jupiter.api.Test;

import org.junit.Assert;
import org.junit.Test;
import static org.assertj.core.api.Fail.fail;

/**
* @author Emmanuel Bernard
*/
@BaseUnitTest
public class ConfigurationTest {
@Test
public void testMixPackageAndResourceOrdering() throws Exception {
public void testMixPackageAndResourceOrdering() {
try (BootstrapServiceRegistry serviceRegistry = new BootstrapServiceRegistryBuilder().build()) {
Configuration config = new Configuration( serviceRegistry );
config.addResource( "org/hibernate/orm/test/annotations/configuration/orm.xml" );
config.addPackage( "org.hibernate.orm/test.annotations.configuration" );
}
catch( Exception e ) {
Assert.fail( "Processing package first when ORM.xml is used should not fail" );
fail( "Processing package first when ORM.xml is used should not fail" );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,83 @@
*/
package org.hibernate.orm.test.annotations.derivedidentities.e1.b;

import org.hibernate.Session;

import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.orm.test.util.SchemaUtil;
import org.junit.Test;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

/**
* @author Emmanuel Bernard
*/
public class DerivedIdentitySimpleParentEmbeddedIdDepTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
public void testManyToOne() throws Exception {
assertTrue( SchemaUtil.isColumnPresent( "Dependent", "emp_empId", metadata() ) );
assertTrue( ! SchemaUtil.isColumnPresent( "Dependent", "empPK", metadata() ) );

Employee e = new Employee();
e.empId = 1;
e.empName = "Emmanuel";
Session s = openSession( );
s.getTransaction().begin();
@SessionFactory
@DomainModel(
annotatedClasses = {
Dependent.class,
Employee.class,
ExclusiveDependent.class
}
)
public class DerivedIdentitySimpleParentEmbeddedIdDepTest {

Dependent d = new Dependent();
d.emp = e;
d.id = new DependentId();
d.id.name = "Doggy";
s.persist( d );
s.persist( e );
s.flush();
s.clear();
d = (Dependent) s.get( Dependent.class, d.id );
assertEquals( d.id.empPK, d.emp.empId );
s.getTransaction().rollback();
s.close();
@AfterEach
public void tearDown(SessionFactoryScope scope) {
scope.getSessionFactory().getSchemaManager().truncateMappedObjects();
}

@Test
public void testOneToOne() throws Exception {
assertTrue( SchemaUtil.isColumnPresent( "ExclusiveDependent", "FK", metadata() ) );
assertTrue( ! SchemaUtil.isColumnPresent( "ExclusiveDependent", "empPK", metadata() ) );
public void testManyToOne(SessionFactoryScope scope) {
MetadataImplementor metadata = scope.getMetadataImplementor();
assertThat( SchemaUtil.isColumnPresent( "Dependent", "emp_empId", metadata ) ).isTrue();
assertThat( !SchemaUtil.isColumnPresent( "Dependent", "empPK", metadata ) ).isTrue();

Employee e = new Employee();
e.empId = 1;
e.empName = "Emmanuel";
Session s = openSession( );
s.getTransaction().begin();
s.persist( e );
ExclusiveDependent d = new ExclusiveDependent();
d.emp = e;
d.id = new DependentId();
d.id.name = "Doggy";
//d.id.empPK = e.empId; //FIXME not needed when foreign is enabled
s.persist( d );
s.flush();
s.clear();
d = (ExclusiveDependent) s.get( ExclusiveDependent.class, d.id );
assertEquals( d.id.empPK, d.emp.empId );
s.getTransaction().rollback();
s.close();
scope.inTransaction(
session -> {
Employee e = new Employee();
e.empId = 1;
e.empName = "Emmanuel";
Dependent d = new Dependent();
d.emp = e;
d.id = new DependentId();
d.id.name = "Doggy";
session.persist( d );
session.persist( e );
session.flush();
session.clear();
d = session.find( Dependent.class, d.id );
assertThat( d.emp.empId ).isEqualTo( d.id.empPK );
}
);
}

@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {
Dependent.class,
Employee.class,
ExclusiveDependent.class
};
@Test
public void testOneToOne(SessionFactoryScope scope) {
MetadataImplementor metadata = scope.getMetadataImplementor();
assertThat( SchemaUtil.isColumnPresent( "ExclusiveDependent", "FK", metadata ) ).isTrue();
assertThat( !SchemaUtil.isColumnPresent( "ExclusiveDependent", "empPK", metadata ) ).isTrue();

scope.inTransaction(
session -> {
Employee e = new Employee();
e.empId = 1;
e.empName = "Emmanuel";
session.persist( e );
ExclusiveDependent d = new ExclusiveDependent();
d.emp = e;
d.id = new DependentId();
d.id.name = "Doggy";
//d.id.empPK = e.empId; //FIXME not needed when foreign is enabled
session.persist( d );
session.flush();
session.clear();
d = session.find( ExclusiveDependent.class, d.id );
assertThat( d.emp.empId ).isEqualTo( d.id.empPK );
}
);
}

}
Loading
Loading