Following comments apply to seam-sql5 rev...<br><br>1) In Tuple class:<br><br><div style="margin-left: 40px;"><font size="1">public <T> T get(int column, Type<T> type) {<br> return (T) get(column);<br> }<br>
<br></font></div><font size="2">The type param is not referenced in the body of the method. Why?</font><br><br>2) So I added this method in the Tuple class:<br><br><div style="margin-left: 40px;"><font size="1">@SuppressWarnings("unchecked")<br>
public <T> T testGet(int column) {<br> return (T) get(column);<br> }<br><br></font></div><font size="1"><font size="2"> And changed testQuery3() to this:</font><br><br>public static void testQuery3(Session session) {<br>
System.out.println("begin testQuery3()");<br> Iterable<Tuple> result = session.prepareQuery("select username, name, password, age from users where username=?")<br> .set(0, "gavin", VARCHAR)<br>
.result();<br> <br> for (Tuple tuple: result) {<br> System.out.println( tuple.testGet(0));<br> System.out.println( tuple.testGet(1));<br> System.out.println( tuple.testGet(2));<br>
System.out.println( tuple.testGet(3));<br> }<br> }<br><br><font size="2">And got the same results in the console. </font></font><font size="1"><font size="2">I don't like to be forced to pass the datatype in the get() method for Tuple, that should not be requierd.</font></font><br>
<font size="1"><font size="2"><br>3) This is looking pretty good to me now in terms of conciseness and clarity:<br><br></font></font><div style="margin-left: 40px;"><font size="1"><font size="2"><font size="1">@Inject LoginQuery loginQuery;</font></font></font><br>
<br><font size="1"><font size="2"><font size="1"> public void testLoginQuery(Session session) {</font></font></font><br><font size="1"><font size="2"><font size="1"> </font></font></font><br><font size="1"><font size="2"><font size="1"> </font></font></font><font size="1"><font size="2"><font size="1">Iterable<Tuple> result = session.prepare(loginQuery)</font></font></font><font size="1"><font size="2"><font size="1">.set(loginQuery.username, "gavin")</font></font></font><font size="1"><font size="2"><font size="1">.set(loginQuery.password, "foobax")</font></font></font><font size="1"><font size="2"><font size="1">.result();</font></font></font><br>
<font size="1"><font size="2"><font size="1"> </font></font></font><br><font size="1"><font size="2"><font size="1"> for (Tuple tuple: result) {</font></font></font><br><font size="1"><font size="2"><font size="1"> System.out.println( tuple.get(loginQuery.name) + ' ' + </font></font></font><font size="1"><font size="2"><font size="1">tuple.get(loginQuery.age) + ' ' + </font></font></font><font size="1"><font size="2"><font size="1">tuple.get(loginQuery.permissionId) );</font></font></font><br>
<font size="1"><font size="2"><font size="1"> }</font></font></font><br><font size="1"><font size="2"><font size="1"> }</font></font></font><br></div><font size="1"><font size="2"><br>I need to take the time (when I have some!) to look at this API in detail but the latest rev's addition of sql string as param to query exec is a nice addition. Good job!<br>
</font></font><br><div class="gmail_quote">On Fri, Nov 27, 2009 at 3:16 PM, Gavin King <span dir="ltr"><<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
New rev, with ability to pass SQL as strings.<br>
<div class="im"><br>
On Fri, Nov 27, 2009 at 4:47 PM, Gavin King <<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>> wrote:<br>
> Latest, with a new approach to specifying types.<br>
><br>
<br>
<br>
<br>
</div>--<br>
<div><div></div><div class="h5">Gavin King<br>
<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
<a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
<a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
<a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
</div></div><br>_______________________________________________<br>
weld-dev mailing list<br>
<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br></blockquote></div><br>