Is there any way to convert querydsl query to native query including query parameters? Currently i have something like
QDrm qdrm = QDrm.drm;
String table = "drm";
Path<Object> userPath = new PathImpl<Object>(Object.class, table);
StringPath usernamePath = Expressions.stringPath(userPath, "accessory_id");
query.from(qdrm).where(qdrm.accessory_id.eq(100l));
query.where(qdrm.time.lt("2104-04-14"));
System.out.println(query.getSQL(usernamePath).getSQL());
This results in following output :
select drm.accessory_id
from drm
where drm.accessory_id = ? and drm.time < ?
My goal is to produce
select drm.accessory_id
from drm
where drm.accessory_id = 100 and drm.time < "2104-04-14"
The query will be executed manually or by some other means outside of QueryDSL.
Thanks for you help.
Use the setUseLiterals() method on the Configuration or on the SQLQuery object. This has been answered here:
How to get fully materialized query from querydsl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With