<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Extending query by example through annotation</title>
	<atom:link href="http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/feed/" rel="self" type="application/rss+xml" />
	<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/</link>
	<description>Blog by a developer for a developer</description>
	<lastBuildDate>Tue, 24 Aug 2010 13:52:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Coralie</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-14541</link>
		<dc:creator>Coralie</dc:creator>
		<pubDate>Thu, 22 Oct 2009 08:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-14541</guid>
		<description>I am also interested on getting the source code. I have a doubt on performance of such a system.</description>
		<content:encoded><![CDATA[<p>I am also interested on getting the source code. I have a doubt on performance of such a system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-272</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Tue, 04 Mar 2008 00:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-272</guid>
		<description>Hi Ben,

Unfortunately I implemented the reference implementation of this for a client so the source is proprietary.  If you could share what you have done as an open source project I would be happy to contribute directly :)  You could easily initiate an open-source project on &lt;a href=&quot;http://code.google.com/&quot; title=&quot;Google Code&quot; rel=&quot;nofollow&quot;&gt;Google Code&lt;/a&gt;.

Jacob</description>
		<content:encoded><![CDATA[<p>Hi Ben,</p>
<p>Unfortunately I implemented the reference implementation of this for a client so the source is proprietary.  If you could share what you have done as an open source project I would be happy to contribute directly <img src='http://solutionsfit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   You could easily initiate an open-source project on <a href="http://code.google.com/" title="Google Code" rel="nofollow">Google Code</a>.</p>
<p>Jacob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Neuman</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-270</link>
		<dc:creator>Ben Neuman</dc:creator>
		<pubDate>Mon, 03 Mar 2008 21:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-270</guid>
		<description>Jacob,
I&#039;d like to try this in my project but I&#039;m struggling a bit with the final implementation. Would you be willing to post or send the complete set of source files?

Thanks
Ben</description>
		<content:encoded><![CDATA[<p>Jacob,<br />
I&#8217;d like to try this in my project but I&#8217;m struggling a bit with the final implementation. Would you be willing to post or send the complete set of source files?</p>
<p>Thanks<br />
Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-17</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Wed, 12 Dec 2007 03:47:30 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-17</guid>
		<description>Hi Chris,

Thanks for the comment!  Yes, Seam&#039;s Query object can accomplish the same thing, but in the example provided you would have difficulty binding the minPrice and maxPrice to the Product example directly:

&lt;pre&gt;...
&lt;outputLabel value=&quot;Min Price&quot; /&gt;
&lt;h:inputText value=&quot;#{product.price}&quot; /&gt;
&lt;outputLabel value=&quot;Max Price&quot; /&gt;
&lt;h:inputText value=&quot;#{product.price}&quot; /&gt;
...&lt;/pre&gt;

We would need additional attributes to hold the minPrice and maxPrice for interaction with the user:

&lt;pre&gt;...
&lt;h:outputLabel value=&quot;Min Price&quot; /&gt;
&lt;h:inputText value=&quot;#{productCriteria.minPrice}&quot; /&gt;
&lt;h:outputLabel value=&quot;Max Price&quot; /&gt;
&lt;h:inputText value=&quot;#{productCriteria.maxPrice}&quot; /&gt;
...&lt;/pre&gt;

No doubt, you could use EL with Seam&#039;s Query object to accomplish this:

&lt;pre&gt;...
&lt;framework:restrictions&gt;
        &lt;value&gt;price &gt; #{productCriteria.minPrice}&lt;/value&gt;
        &lt;value&gt;price &lt; #{productCriteria.maxPrice}&lt;/value&gt;
        ...&lt;/pre&gt;

But you are still creating extra attributes to hold the minPrice and maxPrice, a criteria object just seamed to make the most sense for this data (especially if you wanted to allow the user to save the criteria).  As far as declaratively specifying criteria on the example, you could do so, but it would make your domain object specific to the query (which is probably not desirable if you want to reuse the domain object).

I am a fan of the Seam Query object, and I definitely recommend it, but the advantages I would say boil down to:

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Vendor independence:&lt;/strong&gt; Using the Seam application framework is very Seam specific.  This approach allows you to swap out Criteria implementations by simply changing the annotation processing in one place.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;One-stop shop:&lt;/strong&gt; Criteria declaratively specified at the point of definition, rather than in XML so no hunting for configuration.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;JPA consistency:&lt;/strong&gt; looks like JPA through use of annotations&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Static type-checking:&lt;/strong&gt; XML requires special tools to validate and no coding in XML (this is a big Web Beans philosophy)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Code generation:&lt;/strong&gt; annotations make it simple to develop a processor that could generate the associated view on the fly.&lt;/li&gt;
&lt;/ul&gt;

I definitely agree that I am not fond of repeating attributes that are already contained on the domain object in a criteria object and I see this as a definite disadvantage of the @Criteria approach.  As shown in the Seam Query example a simple query for Person by setting the firstName attribute as the example, to repeat this attribute in a Criteria object would certainly defeat the DRY principal.  I will think further on your suggestion and see if I can come up with an approach that declaratively uses the example as well as any additional criteria.  

Thanks for the suggestion, always appreciated.</description>
		<content:encoded><![CDATA[<p>Hi Chris,</p>
<p>Thanks for the comment!  Yes, Seam&#8217;s Query object can accomplish the same thing, but in the example provided you would have difficulty binding the minPrice and maxPrice to the Product example directly:</p>
<pre>...
&lt;outputLabel value="Min Price" /&gt;
&lt;h:inputText value="#{product.price}" /&gt;
&lt;outputLabel value="Max Price" /&gt;
&lt;h:inputText value="#{product.price}" /&gt;
...</pre>
<p>We would need additional attributes to hold the minPrice and maxPrice for interaction with the user:</p>
<pre>...
&lt;h:outputLabel value="Min Price" /&gt;
&lt;h:inputText value="#{productCriteria.minPrice}" /&gt;
&lt;h:outputLabel value="Max Price" /&gt;
&lt;h:inputText value="#{productCriteria.maxPrice}" /&gt;
...</pre>
<p>No doubt, you could use EL with Seam&#8217;s Query object to accomplish this:</p>
<pre>...
&lt;framework:restrictions>
        &lt;value&gt;price > #{productCriteria.minPrice}&lt;/value&gt;
        &lt;value&gt;price < #{productCriteria.maxPrice}&lt;/value&gt;
        ...</pre>
<p>But you are still creating extra attributes to hold the minPrice and maxPrice, a criteria object just seamed to make the most sense for this data (especially if you wanted to allow the user to save the criteria).  As far as declaratively specifying criteria on the example, you could do so, but it would make your domain object specific to the query (which is probably not desirable if you want to reuse the domain object).</p>
<p>I am a fan of the Seam Query object, and I definitely recommend it, but the advantages I would say boil down to:</p>
<ul>
<li><strong>Vendor independence:</strong> Using the Seam application framework is very Seam specific.  This approach allows you to swap out Criteria implementations by simply changing the annotation processing in one place.</li>
<li><strong>One-stop shop:</strong> Criteria declaratively specified at the point of definition, rather than in XML so no hunting for configuration.</li>
<li><strong>JPA consistency:</strong> looks like JPA through use of annotations</li>
<li><strong>Static type-checking:</strong> XML requires special tools to validate and no coding in XML (this is a big Web Beans philosophy)</li>
<li><strong>Code generation:</strong> annotations make it simple to develop a processor that could generate the associated view on the fly.</li>
</ul>
<p>I definitely agree that I am not fond of repeating attributes that are already contained on the domain object in a criteria object and I see this as a definite disadvantage of the @Criteria approach.  As shown in the Seam Query example a simple query for Person by setting the firstName attribute as the example, to repeat this attribute in a Criteria object would certainly defeat the DRY principal.  I will think further on your suggestion and see if I can come up with an approach that declaratively uses the example as well as any additional criteria.  </p>
<p>Thanks for the suggestion, always appreciated.</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Wash</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-16</link>
		<dc:creator>Chris Wash</dc:creator>
		<pubDate>Tue, 11 Dec 2007 23:20:23 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-16</guid>
		<description>Jacob,

Interesting articles so far - I hope you keep these coming!

Quick questions - what advantages would you say this has over Seam&#039;s Query object?

http://docs.jboss.com/seam/2.0.0.GA/reference/en/html_single/#d0e6472

I&#039;m not a fan of &quot;coding in XML&quot; but I don&#039;t really like the idea of a separate product criteria bound to the UI either - seems to go against Seam/Web Beans principles.  Can you think of a way of doing it declaratively on the example??</description>
		<content:encoded><![CDATA[<p>Jacob,</p>
<p>Interesting articles so far &#8211; I hope you keep these coming!</p>
<p>Quick questions &#8211; what advantages would you say this has over Seam&#8217;s Query object?</p>
<p><a href="http://docs.jboss.com/seam/2.0.0.GA/reference/en/html_single/#d0e6472" rel="nofollow">http://docs.jboss.com/seam/2.0.0.GA/reference/en/html_single/#d0e6472</a></p>
<p>I&#8217;m not a fan of &#8220;coding in XML&#8221; but I don&#8217;t really like the idea of a separate product criteria bound to the UI either &#8211; seems to go against Seam/Web Beans principles.  Can you think of a way of doing it declaratively on the example??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web 2.0 Announcer</title>
		<link>http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/comment-page-1/#comment-15</link>
		<dc:creator>Web 2.0 Announcer</dc:creator>
		<pubDate>Tue, 11 Dec 2007 10:16:13 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/04/extending-query-by-example-through-annotation/#comment-15</guid>
		<description>&lt;strong&gt;solutionsfit.com &#124; Jacob Orshalick » Blog Archive » Extending query by example through annotation...&lt;/strong&gt;

[...][...]...</description>
		<content:encoded><![CDATA[<p><strong>solutionsfit.com | Jacob Orshalick » Blog Archive » Extending query by example through annotation&#8230;</strong></p>
<p>[...][...]&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
