|
4 | 4 | */ |
5 | 5 | package org.hibernate.orm.test.mapping.dynamic; |
6 | 6 |
|
| 7 | +import java.util.Collections; |
7 | 8 | import java.util.HashMap; |
8 | 9 | import java.util.Map; |
9 | 10 |
|
10 | 11 | import org.hibernate.Session; |
11 | | -import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; |
12 | 12 |
|
13 | | -import org.junit.Test; |
14 | | - |
15 | | -import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; |
| 13 | +import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; |
| 14 | +import org.hibernate.testing.orm.junit.Jpa; |
| 15 | +import org.hibernate.testing.orm.junit.Setting; |
| 16 | +import org.junit.jupiter.api.Test; |
16 | 17 |
|
17 | 18 | /** |
18 | 19 | * @author Vlad Mihalcea |
19 | 20 | */ |
20 | | -public class DynamicEntityTest extends BaseEntityManagerFunctionalTestCase { |
21 | | - |
22 | | - @Override |
23 | | - protected String[] getMappings() { |
24 | | - return new String[] { |
25 | | - "org/hibernate/orm/test/mapping/dynamic/Book.hbm.xml" |
26 | | - }; |
27 | | - } |
28 | | - |
29 | | - @Override |
30 | | - protected Map buildSettings() { |
31 | | - Map settings = super.buildSettings(); |
| 21 | +@Jpa( |
| 22 | + xmlMappings = {"org/hibernate/orm/test/mapping/dynamic/Book.hbm.xml"}, |
| 23 | + integrationSettings = {@Setting( name = "hibernate.default_entity_mode", value = "dynamic-map")} |
| 24 | +) |
| 25 | +public class DynamicEntityTest { |
| 26 | + |
| 27 | + // Preserved because of the doc inclusions |
| 28 | + protected void doesNothing() { |
| 29 | + Map settings = Collections.EMPTY_MAP; |
32 | 30 | //tag::mapping-model-dynamic-setting-example[] |
33 | 31 | settings.put("hibernate.default_entity_mode", "dynamic-map"); |
34 | 32 | //end::mapping-model-dynamic-setting-example[] |
35 | | - return settings; |
36 | 33 | } |
37 | 34 |
|
38 | 35 | @Test |
39 | | - public void test() { |
40 | | - doInJPA(this::entityManagerFactory, entityManager -> { |
| 36 | + public void test(EntityManagerFactoryScope scope) { |
| 37 | + scope.inTransaction( entityManager -> { |
41 | 38 | //tag::mapping-model-dynamic-example[] |
42 | 39 |
|
43 | 40 | Map<String, String> book = new HashMap<>(); |
|
0 commit comments