HHH-13201 - reformat test
This commit is contained in:
parent
19af434b21
commit
d97db034b4
|
@ -1,6 +1,7 @@
|
|||
package org.hibernate.test.hql;
|
||||
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -13,14 +14,12 @@ import static javax.persistence.CascadeType.ALL;
|
|||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||
|
||||
/**
|
||||
* @author Moritz Becker (moritz.becker@ordami.com)
|
||||
* @date 12/01/2019
|
||||
* @company ordami GmbH
|
||||
* @author Moritz Becker
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-13201")
|
||||
public class FetchNonRootRelativeElementCollectionAndAssociationTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
@Override
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
return new Class<?>[] { ProductNaturalId.class, Product.class, ProductDetail.class };
|
||||
}
|
||||
|
@ -30,10 +29,10 @@ public class FetchNonRootRelativeElementCollectionAndAssociationTest extends Bas
|
|||
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||
// DO NOT CHANGE this query: it used to trigger an error caused
|
||||
// by the origin FromElement for the association fetch being resolved to the wrong FromElement due to the
|
||||
// presence of an element collection join.
|
||||
// presence of an element collection join.
|
||||
String u = "select prod from ProductNaturalId nat inner join nat.product prod " +
|
||||
"left join fetch prod.productDetail " +
|
||||
"left join fetch prod.normalizedPricesByUnit";
|
||||
"left join fetch prod.productDetail " +
|
||||
"left join fetch prod.normalizedPricesByUnit";
|
||||
Query query = entityManager.createQuery( u, Product.class );
|
||||
query.getResultList();
|
||||
} );
|
||||
|
@ -41,31 +40,31 @@ public class FetchNonRootRelativeElementCollectionAndAssociationTest extends Bas
|
|||
|
||||
@Entity(name = "ProductNaturalId")
|
||||
public class ProductNaturalId {
|
||||
@Id
|
||||
private String naturalId;
|
||||
@OneToOne(optional = false)
|
||||
private Product product;
|
||||
}
|
||||
@Id
|
||||
private String naturalId;
|
||||
@OneToOne(optional = false)
|
||||
private Product product;
|
||||
}
|
||||
|
||||
@Entity(name = "Product")
|
||||
public class Product {
|
||||
@Id
|
||||
private Long id;
|
||||
@OneToOne(mappedBy = "product", cascade = ALL, fetch = FetchType.LAZY)
|
||||
private ProductDetail productDetail;
|
||||
@OneToOne(mappedBy = "product", cascade = ALL, fetch = FetchType.LAZY)
|
||||
private ProductNaturalId naturalId;
|
||||
@ElementCollection(fetch = FetchType.LAZY)
|
||||
private Map<String, String> normalizedPricesByUnit = new HashMap<>();
|
||||
}
|
||||
@Id
|
||||
private Long id;
|
||||
@OneToOne(mappedBy = "product", cascade = ALL, fetch = FetchType.LAZY)
|
||||
private ProductDetail productDetail;
|
||||
@OneToOne(mappedBy = "product", cascade = ALL, fetch = FetchType.LAZY)
|
||||
private ProductNaturalId naturalId;
|
||||
@ElementCollection(fetch = FetchType.LAZY)
|
||||
private Map<String, String> normalizedPricesByUnit = new HashMap<>();
|
||||
}
|
||||
|
||||
@Entity(name = "ProductDetail")
|
||||
public class ProductDetail {
|
||||
@Id
|
||||
private Long id;
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "id")
|
||||
@MapsId
|
||||
private Product product;
|
||||
}
|
||||
@Entity(name = "ProductDetail")
|
||||
public class ProductDetail {
|
||||
@Id
|
||||
private Long id;
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "id")
|
||||
@MapsId
|
||||
private Product product;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue