<html><head>

<style id="css_styles"> 
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] {  list-style-position: inside;}
body { font-family: 'Segoe UI'; font-size: 12pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }

 </style>
</head>
<body><div>Hi Amber list,</div><div><br /></div><div>I know the discussion on String Templates has come a bit to a halt.  I just wanted to add my perspective after developing a library which uses the JDK 22 String Templates.  I found the processor syntax, although a bit unintuitive at first, quite a nice fit for handling SQL queries with a thin wrapper around JDBC.  The processor and current transactional scope can be nicely wrapped into a single reference, so you hardly notice there is a processor involved.</div><div><br /></div><div>Where previously I may have written:</div><div><br /></div><div>      try (Transaction tx = db.beginTransaction()) {</div><div>          List<Row> rows = tx.perform("SELECT * FROM employees WHERE a = ?", a).toList();</div><div>      }</div><div><br /></div><div>I now write:</div><div><br /></div><div>      try (Transaction tx = db.beginTransaction()) {<br /><span>          List<Row> rows = </span>tx."SELECT * FROM employees WHERE a = \{a}".toList();</div><div>      }</div><div><span><br /></span></div><div><span>Where the Transaction class implements the processor.     </span></div><div><span><br /></span></div><div>I've been reading the chatter on the experts list, and am especially weary of solution that would not allow for an empty template. For example, it should be easily possible to have a template without parameters without having to change to a different syntax:</div><div><br /></div><div><div><span>       int count = tx."SELECT COUNT(*) FROM employees".asInt().get();</span></div><div><span><br /></span></div><div><span>As this may evolve to for example:</span></div><div><span><br /></span></div><div><div style="background-color:rgba(0,0,0,0);">       int count = tx."SELECT COUNT(*) FROM employees WHERE archived = \{archived}".asInt().get();</div><div style="background-color:rgba(0,0,0,0);"><br /></div><div style="background-color:rgba(0,0,0,0);">(Or vice versa)<br /><br /></div><div style="background-color:rgba(0,0,0,0);"></div></div><div><span>For those interested in how I've been using templates, the library is found here: </span><a href="https://github.com/hjohn/TemplatedJDBC" style="font-size: 12pt;">https://github.com/hjohn/TemplatedJDBC</a> -- I bit the bullet and converted a lot of other (internal) projects to use this syntax, and I found it to work quite well.  I'm looking forward to seeing more progress in this area and to test the next iteration of String Templates when it becomes available.</div><div><br /></div><div>--John</div><div></div></div></body></html>