Skip to content

Conversation

@Mart1031y
Copy link

Extending AbstractHibernateQuery to support simple Common Table Expressions.

@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 0% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (3ed9937) to head (c219fd9).
⚠️ Report is 30 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...java/com/querydsl/jpa/hibernate/HQLSerializer.java 0.00% 36 Missing ⚠️
...querydsl/jpa/hibernate/AbstractHibernateQuery.java 0.00% 9 Missing ⚠️
...c/main/java/com/querydsl/jpa/hibernate/HQLOps.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #1529    +/-   ##
=======================================
  Coverage    0.00%   0.00%            
=======================================
  Files         813     840    +27     
  Lines       31466   31845   +379     
  Branches     3614    3631    +17     
=======================================
- Misses      31466   31845   +379     
Flag Coverage Δ
cubrid 0.00% <0.00%> (?)
db2 0.00% <0.00%> (?)
embedded 0.00% <0.00%> (?)
examples 0.00% <0.00%> (?)
firebird 0.00% <0.00%> (?)
mongodb 0.00% <0.00%> (?)
mysql 0.00% <0.00%> (?)
oracle 0.00% <0.00%> (?)
postgresql 0.00% <0.00%> (?)
test 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

private void handleJoinTarget(JoinExpression je) {
protected void handleJoinTarget(JoinExpression je) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a nicer way to extend the logic of this method.
As NativeSQLSerializer also has a similarly named method, which is also marked as protected I hope this is okay to do.

Comment on lines +102 to +103
public Q with(Path<?> alias, SubQueryExpression<?> query) {
return with(alias, null, query);
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hibernate only supports subqueries here, so there is no WithBuilder options here.
Also, recursive CTEs are not in scope for this change, so those are also not present.

Comment on lines +59 to +67
handle(alias);
withAliases.add(alias);
append(" as ");
if (args.get(1) instanceof ConstantImpl<?> materializedParam
&& materializedParam.getConstant() instanceof Boolean materialized) {
if (!materialized) {
append("not ");
}
append("materialized ");
}
handle(args.get(2));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I wanted to use templates, but I couldn't figure out how to get the (not)? materialized part work with them. So I just append directly here.

Extending AbstractHibernateQuery to support simple Common Table
Expressions.
@Mart1031y Mart1031y force-pushed the feature/1528-hibernate-cte-support branch from 1fcdb17 to c219fd9 Compare January 2, 2026 08:46
@Mart1031y
Copy link
Author

CodeQL build is failing due to commit: 7f244eb.
Error message: Kotlin version 2.3.0 is too recent. CodeQL currently supports versions below 2.2.30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant