Skip to content

Commit d989466

Browse files
marko-bekhtacigaly
authored andcommitted
HHH-19626 Add a test case for mapped superclass with generics and annotation processor
1 parent 97a0c68 commit d989466

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.processor.test.data.generic;
6+
7+
import jakarta.persistence.Entity;
8+
9+
@Entity
10+
public class MyActualEntity extends MyMappedSuperclass<Integer> {
11+
public String myString;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.processor.test.data.generic;
6+
7+
import jakarta.data.repository.CrudRepository;
8+
import jakarta.data.repository.Repository;
9+
10+
@Repository
11+
public interface MyActualEntityRepository extends CrudRepository<MyActualEntity, Integer> {
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.processor.test.data.generic;
6+
7+
import jakarta.persistence.Id;
8+
import jakarta.persistence.MappedSuperclass;
9+
10+
import java.io.Serializable;
11+
12+
@MappedSuperclass
13+
public class MyMappedSuperclass<ID extends Serializable> {
14+
@Id
15+
private ID id;
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.processor.test.data.generic;
6+
7+
import org.hibernate.processor.test.util.CompilationTest;
8+
import org.hibernate.processor.test.util.TestUtil;
9+
import org.hibernate.processor.test.util.WithClasses;
10+
import org.junit.jupiter.api.Test;
11+
12+
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
13+
14+
@CompilationTest
15+
public class MyMappedSuperclassTest {
16+
17+
@Test
18+
@WithClasses({MyActualEntity.class, MyActualEntityRepository.class, MyMappedSuperclass.class})
19+
void smoke() {
20+
System.out.println( TestUtil.getMetaModelSourceAsString( MyMappedSuperclass.class ) );
21+
System.out.println( TestUtil.getMetaModelSourceAsString( MyActualEntity.class ) );
22+
assertMetamodelClassGeneratedFor( MyMappedSuperclass.class );
23+
assertMetamodelClassGeneratedFor( MyActualEntity.class );
24+
}
25+
}

0 commit comments

Comments
 (0)