forked from hibernate/hibernate-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attempt to sort out mess of qualified vs unqualified names
- Loading branch information
Showing
9 changed files
with
184 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...enerator/src/jakartaData/java/org/hibernate/processor/test/data/processingorder/Post.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.processor.test.data.processingorder; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.ManyToOne; | ||
|
||
@Entity | ||
public class Post { | ||
@Id | ||
Integer id; | ||
|
||
String posterId; | ||
|
||
@ManyToOne | ||
protected Topic topic; | ||
} |
18 changes: 18 additions & 0 deletions
18
...rc/jakartaData/java/org/hibernate/processor/test/data/processingorder/PostRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.processor.test.data.processingorder; | ||
|
||
import jakarta.data.repository.DataRepository; | ||
import jakarta.data.repository.Query; | ||
import jakarta.data.repository.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface PostRepository extends DataRepository<Post, Integer> { | ||
|
||
@Query("from Post p where p.topic=:topic") | ||
List<Post> getPostsByTopic(Topic topic); | ||
} |
38 changes: 38 additions & 0 deletions
38
...kartaData/java/org/hibernate/processor/test/data/processingorder/ProcessingOrderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.processor.test.data.processingorder; | ||
|
||
import org.hibernate.processor.test.util.CompilationTest; | ||
import org.hibernate.processor.test.util.WithClasses; | ||
import org.junit.Test; | ||
|
||
import java.lang.reflect.Method; | ||
import java.lang.reflect.ParameterizedType; | ||
import java.util.List; | ||
|
||
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor; | ||
import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfMethodInMetamodelFor; | ||
import static org.hibernate.processor.test.util.TestUtil.getMethodFromMetamodelFor; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
public class ProcessingOrderTest extends CompilationTest { | ||
@Test | ||
@WithClasses({Post.class, PostRepository.class, Topic.class}) | ||
public void test() { | ||
assertMetamodelClassGeneratedFor( PostRepository.class ); | ||
|
||
assertPresenceOfMethodInMetamodelFor( PostRepository.class, "getPostsByTopic", Topic.class ); | ||
final Method method = getMethodFromMetamodelFor( PostRepository.class, "getPostsByTopic", Topic.class ); | ||
assertEquals( Topic.class, method.getParameterTypes()[0] ); | ||
if ( method.getGenericReturnType() instanceof ParameterizedType parameterizedType ) { | ||
assertEquals( List.class, parameterizedType.getRawType() ); | ||
assertEquals( Post.class, parameterizedType.getActualTypeArguments()[0] ); | ||
} | ||
else { | ||
fail(); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...nerator/src/jakartaData/java/org/hibernate/processor/test/data/processingorder/Topic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.processor.test.data.processingorder; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.OrderBy; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
public class Topic { | ||
@Id | ||
Integer id; | ||
|
||
@OneToMany(mappedBy = "topic", targetEntity = Post.class) | ||
@OrderBy | ||
private List<Post> posts; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.