File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed
tooling/metamodel-generator/src
jakartaData/java/org/hibernate/processor/test/data/embeddedid
main/java/org/hibernate/processor/annotation Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: LGPL-2.1-or-later
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate .processor .test .data .embeddedid ;
6
+
7
+ import org .hibernate .processor .test .util .CompilationTest ;
8
+ import org .hibernate .processor .test .util .WithClasses ;
9
+ import org .junit .Test ;
10
+
11
+ import static org .hibernate .processor .test .util .TestUtil .assertMetamodelClassGeneratedFor ;
12
+ import static org .hibernate .processor .test .util .TestUtil .getMetaModelSourceAsString ;
13
+
14
+ /**
15
+ * @author Gavin King
16
+ */
17
+ public class EmbeddedIdTest extends CompilationTest {
18
+ @ Test
19
+ @ WithClasses ({ Thing .class , ThingRepo .class })
20
+ public void test () {
21
+ System .out .println ( getMetaModelSourceAsString ( ThingRepo .class ) );
22
+ assertMetamodelClassGeneratedFor ( Thing .class , true );
23
+ assertMetamodelClassGeneratedFor ( Thing .class );
24
+ assertMetamodelClassGeneratedFor ( ThingRepo .class );
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: LGPL-2.1-or-later
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate .processor .test .data .embeddedid ;
6
+
7
+ import jakarta .persistence .Embeddable ;
8
+ import jakarta .persistence .EmbeddedId ;
9
+ import jakarta .persistence .Entity ;
10
+
11
+ @ Entity
12
+ public class Thing {
13
+ @ Embeddable
14
+ public static class Id {
15
+ long id ;
16
+ String key ;
17
+ }
18
+
19
+ @ EmbeddedId Id id ;
20
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: LGPL-2.1-or-later
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate .processor .test .data .embeddedid ;
6
+
7
+ import jakarta .data .repository .CrudRepository ;
8
+ import jakarta .data .repository .Find ;
9
+ import jakarta .data .repository .Repository ;
10
+
11
+ @ Repository
12
+ public interface ThingRepo extends CrudRepository <Thing , Thing .Id > {
13
+ @ Find
14
+ Thing thing (Thing .Id id );
15
+ }
Original file line number Diff line number Diff line change @@ -2226,7 +2226,7 @@ private static TypeMirror memberType(Element member) {
2226
2226
final AccessType accessType = getAccessType (entityType );
2227
2227
final String nextToken = tokens .nextToken ();
2228
2228
for ( Element member : context .getAllMembers (entityType ) ) {
2229
- if ( isIdRef (nextToken ) && hasAnnotation ( member , ID ) ) {
2229
+ if ( isIdRef (nextToken ) && hasAnnotation (member , ID , EMBEDDED_ID ) ) {
2230
2230
return member ;
2231
2231
}
2232
2232
final Element match =
You can’t perform that action at this time.
0 commit comments