CTE Mapping within EntityView #1769
-
Is the example given in https://stackoverflow.com/questions/67302342/how-to-avoid-n1-problem-with-native-sql-query-in-springboot-with-hibernate/67336967#67336967 the only way of mapping cte fields into the entity view? Seems like in this case a subquery is generated instead of CTE. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
It depends what you want to achieve or what the CTE does. If you want to e.g. limit the result of a collection or entity result, you could also create a
Depending on the database that you are using, inlining of the CTE might be the only way to implement this. |
Beta Was this translation helpful? Give feedback.
It depends what you want to achieve or what the CTE does. If you want to e.g. limit the result of a collection or entity result, you could also create a
@Mapping
with@Limit
. If you want to use a recursive CTE, you will have to do what the StackOverflow post describes.Depending on the database that you are using, inlining of the CTE might be the only way to implement this.