After writing all that, I think I've spotted the answer to both my 
questions. I hadn't realized that bind() returns another ResultQuery. In my 
proof-of-concept code I was attaching and binding my DSL-constructed query 
object and executing that directly. Now I see that I can get a new 
ResultQuery from the bind, and attach and execute that, leaving the 
original query object unattached (though not unbound it seems...which seems 
a little wonky to me). The new ResultQuery will go out of scope which I 
suppose is a way of "detaching" it. From running in a debugger it looks to 
me like this new ResultQuery is indeed a separate object from the original 
query object and so I assume I should have no thread-safety concerns if 
always create a new ResultQuery with bind and use that. Is that all correct?

Is bind() essentially doing query object "cloning"?

I still wonder if it wouldn't be nicer to have some API distinction between 
stateful statement building objects and immutable objects obtainable from 
them representing sql statements (or parts) that you have built. Perhaps 
this is overly idealistic to expect this in conjunction with a fluent DSL 
style API.

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to