Query string for Query object or SelectQuery using jOOQ
1 answer
You cannot use String
for any Java object. You can:
Convert SQL string to jOOQ query
With the jOOQ DSL API, you would write something like:
DSL.using(configuration)
.select()
.from(CAR);
With the jOOQ Model API (i.e. to create SelectQuery
), you should write something like:
SelectQuery select = DSL.using(configuration).selectQuery();
select.addFrom(CAR);
You are looking for the latter. The two APIs are compared here in the manual
Insert SQL string into jOOQ query
This is not what you are looking for, but for completeness, you can also embed SQL strings directly into jOOQ objects, for example.
ResultQuery<?> query = DSL.using(configuration).resultQuery("SELECT * FROM car");
+2
source to share