Hi,
I am perplexed by this simple question. Is the usage of the static DSLContext and the Query.getSQL thread-safe?
In my case I am using jOOQ to provide type-safety and a more intuitive SQL query creation in my Spring MVC web application.
My DAO will generate the necessary SQL statement and execute it using Spring's JDBCTemplate.
private static final DSLContext CREATE = DSL.using(SQLDialect.MYSQL);
List<Products> products = new ArrayList<Products>();
String sql = CREATE.select().from(Products.PRODUCTS).getSQL();
products = getJdbcTemplate().query(sql, new SimpleProductMapper());
With CREATE being a static variable, I am not sure of the consequence of running this code on my system where severel threads could use this DAO at the same time.
Is there a way to make the getSQL mechanism safe to render the SQL without influencing other threads?
Is this a fair concern?
I'll be very grateful if anyone could point me to a solution.
Thanks in advance.