File tree Expand file tree Collapse file tree 5 files changed +102
-0
lines changed
tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/selectenumproperty Expand file tree Collapse file tree 5 files changed +102
-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 .processor .test .data .selectenumproperty ;
8+
9+ import jakarta .persistence .Entity ;
10+ import jakarta .persistence .GeneratedValue ;
11+ import jakarta .persistence .Id ;
12+
13+ @ Entity
14+ public class Topic {
15+
16+ @ Id
17+ @ GeneratedValue
18+ private Integer topicId ;
19+
20+ private TopicStatus topicStatus ;
21+ }
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 .processor .test .data .selectenumproperty ;
8+
9+
10+ record TopicData (Integer topicId , TopicStatus topicStatus ) {
11+
12+ }
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 .processor .test .data .selectenumproperty ;
8+
9+ import jakarta .data .repository .DataRepository ;
10+ import jakarta .data .repository .Query ;
11+ import jakarta .data .repository .Repository ;
12+
13+ import java .util .List ;
14+
15+ @ Repository
16+ public interface TopicRepository extends DataRepository <Topic , Integer > {
17+
18+ @ Query ("select topicId, topicStatus from Topic" )
19+ List <TopicData > getTopicData ();
20+ }
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 .processor .test .data .selectenumproperty ;
8+
9+ public enum TopicStatus {
10+ TOPIC_UNLOCKED ( 0 ),
11+ TOPIC_LOCKED ( 1 );
12+
13+ private final int topicStatus ;
14+
15+ TopicStatus (final int topicStatus ) {
16+ this .topicStatus = topicStatus ;
17+ }
18+
19+ public int topicStatus () {
20+ return topicStatus ;
21+ }
22+ }
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 .processor .test .data .selectenumproperty ;
8+
9+ import org .hibernate .processor .test .util .CompilationTest ;
10+ import org .hibernate .processor .test .util .WithClasses ;
11+ import org .junit .Test ;
12+
13+ import static org .hibernate .processor .test .util .TestUtil .assertMetamodelClassGeneratedFor ;
14+ import static org .hibernate .processor .test .util .TestUtil .getMetaModelSourceAsString ;
15+
16+ public class TopicTypeEnumTest extends CompilationTest {
17+ @ Test
18+ @ WithClasses ({Topic .class , TopicRepository .class })
19+ public void test () {
20+ System .out .println ( getMetaModelSourceAsString ( Topic .class ) );
21+ System .out .println ( getMetaModelSourceAsString ( Topic .class , true ) );
22+ System .out .println ( getMetaModelSourceAsString ( TopicRepository .class ) );
23+ assertMetamodelClassGeneratedFor ( Topic .class , true );
24+ assertMetamodelClassGeneratedFor ( Topic .class );
25+ assertMetamodelClassGeneratedFor ( TopicRepository .class );
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments