File tree Expand file tree Collapse file tree 6 files changed +126
-0
lines changed
hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/joinedsubclass Expand file tree Collapse file tree 6 files changed +126
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6
+ */
7
+ package org .hibernate .test .inheritance .discriminator .joinedsubclass ;
8
+
9
+ /**
10
+ * @author Andrea Boriero
11
+ */
12
+ public interface Common extends TestEntity {
13
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6
+ */
7
+ package org .hibernate .test .inheritance .discriminator .joinedsubclass ;
8
+
9
+ import org .hibernate .testing .TestForIssue ;
10
+ import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
11
+ import org .hibernate .testing .transaction .TransactionUtil ;
12
+ import org .junit .Test ;
13
+
14
+ /**
15
+ * @author Andrea Boriero
16
+ */
17
+ public class JoinedSubclassWithRootInterfaceTest extends BaseCoreFunctionalTestCase {
18
+
19
+ @ Override
20
+ protected String [] getMappings () {
21
+ return new String [] {"TestEntity.hbm.xml" };
22
+ }
23
+
24
+ @ Override
25
+ protected String getBaseForMappings () {
26
+ return "org/hibernate/test/inheritance/discriminator/joinedsubclass/" ;
27
+ }
28
+
29
+ @ Test
30
+ @ TestForIssue ( jiraKey = "HHH-11554" )
31
+ public void testIt () {
32
+ TransactionUtil .doInHibernate ( this ::sessionFactory , session -> {
33
+ final TestEntityImpl testEntity = new TestEntityImpl ();
34
+ testEntity .setId ( 1 );
35
+ session .save ( testEntity );
36
+ } );
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE hibernate-mapping PUBLIC
2
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
3
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
4
+ <hibernate-mapping package =" org.hibernate.test.inheritance.discriminator.joinedsubclass" >
5
+ <class name =" TestEntityInterface" table =" MY_ENTITY" abstract =" true" discriminator-value =" null" >
6
+ <cache usage =" transactional" />
7
+ <id name =" id" column =" ID" access =" property" />
8
+ <discriminator column =" TYPE" type =" big_integer" force =" true" />
9
+ </class >
10
+
11
+ <subclass name =" TestEntityImpl" extends =" TestEntityInterface" discriminator-value =" 1" lazy =" false" >
12
+
13
+ </subclass >
14
+ </hibernate-mapping >
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6
+ */
7
+ package org .hibernate .test .inheritance .discriminator .joinedsubclass ;
8
+
9
+ /**
10
+ * @author Andrea Boriero
11
+ */
12
+ public interface TestEntity {
13
+ Integer getId ();
14
+ void setId (Integer id );
15
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6
+ */
7
+ package org .hibernate .test .inheritance .discriminator .joinedsubclass ;
8
+
9
+ import javax .persistence .Id ;
10
+
11
+ /**
12
+ * @author Andrea Boriero
13
+ */
14
+ @ javax .persistence .Entity
15
+ public class TestEntityImpl implements TestEntityInterface {
16
+ @ Id
17
+ private Integer id ;
18
+
19
+ @ Override
20
+ public Integer getId () {
21
+ return id ;
22
+ }
23
+
24
+ @ Override
25
+ public void setId (Integer id ) {
26
+ this .id = id ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Hibernate, Relational Persistence for Idiomatic Java
3
+ *
4
+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5
+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6
+ */
7
+ package org .hibernate .test .inheritance .discriminator .joinedsubclass ;
8
+
9
+ import javax .persistence .Inheritance ;
10
+ import javax .persistence .InheritanceType ;
11
+
12
+ /**
13
+ * @author Andrea Boriero
14
+ */
15
+ @ javax .persistence .Entity
16
+ @ Inheritance (strategy = InheritanceType .JOINED )
17
+ public interface TestEntityInterface extends Common {
18
+ }
You can’t perform that action at this time.
0 commit comments