HHH-17885 Test for same named attribute of different Embedded uses same selection expression
This commit is contained in:
parent
50ff8dc8af
commit
62836b5dcf
|
@ -11,6 +11,7 @@ import java.io.Serializable;
|
|||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -23,4 +24,7 @@ public class Address implements Serializable {
|
|||
Country country;
|
||||
@ManyToOne
|
||||
AddressType type;
|
||||
|
||||
@Formula("1")
|
||||
Integer formula;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.hibernate.orm.test.bootstrap.binding.annotations.embedded;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
@Embeddable
|
||||
public class AddressBis {
|
||||
|
||||
@Formula("2")
|
||||
Integer formula;
|
||||
}
|
|
@ -100,10 +100,13 @@ public class EmbeddedTest {
|
|||
assertNotNull( p );
|
||||
assertNotNull( p.address );
|
||||
assertEquals( "Springfield", p.address.city );
|
||||
assertEquals( (Integer) 1, p.address.formula );
|
||||
|
||||
assertNotNull( p.address.country );
|
||||
assertEquals( "DM", p.address.country.getIso2() );
|
||||
assertNotNull( p.bornIn );
|
||||
assertEquals( "US", p.bornIn.getIso2() );
|
||||
assertEquals( (Integer) 2, p.addressBis.formula );
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ public class Person implements Serializable {
|
|||
@Embedded
|
||||
Address address;
|
||||
|
||||
@Embedded
|
||||
AddressBis addressBis;
|
||||
|
||||
@Embedded
|
||||
@AttributeOverrides( {
|
||||
@AttributeOverride(name = "iso2", column = @Column(name = "bornIso2")),
|
||||
|
|
Loading…
Reference in New Issue