If we're caching client-side we could cache the format string of the statement and then just add the discriminator. TBD.
I'm not exactly following this statement. "client-side"? Assuming "client-side" means Hibernate, then "cache the format string of the statement" is not a good idea imo. I generally dislike using the same field to represent multiple things (here a full SQL versus a "templated" SQL); that always leads to problems later in my experience. Also a major outcome of the work for 6.0 is to have a AST (tree) representation of the query rather than just a String representation. There the choice is simple between:
- (parameter) Grab the AST, generate the PreparedStatement, bind the param value and execute
- (literal) Grab the AST, "clone" it, add the discriminator node and execute
I think that keeps it simple and covers the most use cases at the same time.
Me too, which is why I suggested it  |