<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
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/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>java rants &#187; criteria</title> <atom:link href="http://www.javarants.com/tag/criteria/feed/" rel="self" type="application/rss+xml" /><link>http://www.javarants.com</link> <description>Rants about Java and other internet technologies by Sam Pullara</description> <lastBuildDate>Sun, 09 Oct 2011 23:29:31 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>JPA 2.0 with Criteria</title><link>http://www.javarants.com/2008/03/15/jpa-20-with-criteria/</link> <comments>http://www.javarants.com/2008/03/15/jpa-20-with-criteria/#comments</comments> <pubDate>Sun, 16 Mar 2008 01:51:12 +0000</pubDate> <dc:creator>Sam Pullara</dc:creator> <category><![CDATA[gauntlet]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[criteria]]></category> <category><![CDATA[EJB-QL]]></category> <category><![CDATA[hibernate]]></category> <category><![CDATA[jpa]]></category> <category><![CDATA[orm]]></category> <guid
isPermaLink="false">http://www.javarants.com/2008/03/15/jpa-20-with-criteria/</guid> <description><![CDATA[(see: JSR 317 Persistently Improving) I love the idea of adding a criteria API to JPA, the only thing I hope that they do differently than Hibernate is to implement that API in addition to string queries.  In Gauntlet we had &#8230; <a
href="http://www.javarants.com/2008/03/15/jpa-20-with-criteria/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>(see: <a
href="http://www.sdtimes.com/content/article.aspx?ArticleID=31655">JSR 317 Persistently Improving</a>)</p><p>I love the idea of adding a criteria API to JPA, the only thing I hope that they do differently than Hibernate is to implement that API in addition to string queries.  In Gauntlet we had issues where we wanted to use EJB-QL for selecting the right data and then a criteria-like API for applying security and filtering constraints on the query.  We ended up writing a criteria-like API that augmented the WHERE clause of the query to get the behavior that we needed (like described <a
href="http://www.javalobby.org/articles/hibernatequery102/">here</a>).  For example, you could do this:</p><pre>
Query q = em.createQuery("SELECT p FROM Project p");
q.addExpression(Expression.notEqual("id", 2));
</pre><p>Or something like that. This would give you the best of both worlds, where you have the expressiveness of the textual query and the ability to further hone that query programmatically.</p> ]]></content:encoded> <wfw:commentRss>http://www.javarants.com/2008/03/15/jpa-20-with-criteria/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
