<?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: Hibernate Criteria API Bug</title>
	<atom:link href="http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/</link>
	<description>Software Development, IT, Gadgets, and Startups</description>
	<pubDate>Tue, 06 Jan 2009 05:46:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: gtuhl</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-235</link>
		<dc:creator>gtuhl</dc:creator>
		<pubDate>Fri, 15 Aug 2008 17:52:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-235</guid>
		<description>Unfortunately the code is pretty tightly coupled to the project in its current state.  I have been meaning for a long time to break it into a clean library (with Hibernate being the only dependency) for a long time but its one of those things that keeps getting pushed.

At a high level it works right now where the interface creates an AST that is persisted to the database and then we have code that traverses that AST and builds up a big Hibernate query using the Criteria API.

It started out as a much simpler thing that may or may not fit for your project - essentially just a user-exposed wrapper around the Criteria API.  A configured list of Hibernate entities, the properties of those entities the user is allowed to search, some small set of operations, and then the user picks an entity, a property, an operation, and then enters a value.

So a user configures however many "lines" of a filter in this way - entity, property, operator, value.  Then they could select whether to OR or AND them.  Then you can create a query using the Criteria API, create a Disjunction/Conjunction, attach all of the criteria the user has selected to that and run it.  The Criteria API is key as it does the really heavy part of translating the query to SQL.  It lets you work at a very high level.  This version of the filter worked a lot like the iTunes smart playlist filter does if you want a visual example.  That sort of filter maps very nicely and cleanly onto Hibernate's Criteria API.

The current version we are using has gotten a lot more complex in order to handle cases where entity/property/operator/value was not sufficient and we also allow arbitrary combinations of boolean logic by the user but we ran with the simpler version for a long time.

Sorry that isn't much help and so vague.  I would gladly provide a real code example if it was easy to do so, its just touching too many places right now and cannot be used outside of the overall project.

Joe</description>
		<content:encoded><![CDATA[<p>Unfortunately the code is pretty tightly coupled to the project in its current state.  I have been meaning for a long time to break it into a clean library (with Hibernate being the only dependency) for a long time but its one of those things that keeps getting pushed.</p>
<p>At a high level it works right now where the interface creates an AST that is persisted to the database and then we have code that traverses that AST and builds up a big Hibernate query using the Criteria API.</p>
<p>It started out as a much simpler thing that may or may not fit for your project - essentially just a user-exposed wrapper around the Criteria API.  A configured list of Hibernate entities, the properties of those entities the user is allowed to search, some small set of operations, and then the user picks an entity, a property, an operation, and then enters a value.</p>
<p>So a user configures however many &#8220;lines&#8221; of a filter in this way - entity, property, operator, value.  Then they could select whether to OR or AND them.  Then you can create a query using the Criteria API, create a Disjunction/Conjunction, attach all of the criteria the user has selected to that and run it.  The Criteria API is key as it does the really heavy part of translating the query to SQL.  It lets you work at a very high level.  This version of the filter worked a lot like the iTunes smart playlist filter does if you want a visual example.  That sort of filter maps very nicely and cleanly onto Hibernate&#8217;s Criteria API.</p>
<p>The current version we are using has gotten a lot more complex in order to handle cases where entity/property/operator/value was not sufficient and we also allow arbitrary combinations of boolean logic by the user but we ran with the simpler version for a long time.</p>
<p>Sorry that isn&#8217;t much help and so vague.  I would gladly provide a real code example if it was easy to do so, its just touching too many places right now and cannot be used outside of the overall project.</p>
<p>Joe</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Long</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-234</link>
		<dc:creator>Keith Long</dc:creator>
		<pubDate>Fri, 15 Aug 2008 16:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-234</guid>
		<description>I would be very interested in hearing more about how you allow your users to build complex queries using a GUI using AST/ examples.

This is something that I require for a project that I'm building and can't find anything out there to do that.</description>
		<content:encoded><![CDATA[<p>I would be very interested in hearing more about how you allow your users to build complex queries using a GUI using AST/ examples.</p>
<p>This is something that I require for a project that I&#8217;m building and can&#8217;t find anything out there to do that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kanugula</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-187</link>
		<dc:creator>Kanugula</dc:creator>
		<pubDate>Sun, 04 May 2008 05:17:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-187</guid>
		<description>I have been searching on how to select subset of columns using Criteria. I was not aware of Projections. Thanks for your help.</description>
		<content:encoded><![CDATA[<p>I have been searching on how to select subset of columns using Criteria. I was not aware of Projections. Thanks for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gtuhl</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-155</link>
		<dc:creator>gtuhl</dc:creator>
		<pubDate>Tue, 26 Feb 2008 13:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-155</guid>
		<description>I'd certainly be willing to take a look at it.  Is there a link for the project?  Hibernate is a beast, and it's got its fair share of issues, but its got some real power behind it if you invest the time.  The criteria API is the most buggy area of the library.

I also bust out to JDBC whenever I need to do something especially tricky or bulk in nature and then use evict/flush/refresh as needed to keep the Hibernate cache in sync.</description>
		<content:encoded><![CDATA[<p>I&#8217;d certainly be willing to take a look at it.  Is there a link for the project?  Hibernate is a beast, and it&#8217;s got its fair share of issues, but its got some real power behind it if you invest the time.  The criteria API is the most buggy area of the library.</p>
<p>I also bust out to JDBC whenever I need to do something especially tricky or bulk in nature and then use evict/flush/refresh as needed to keep the Hibernate cache in sync.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillermo Schwarz</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-154</link>
		<dc:creator>Guillermo Schwarz</dc:creator>
		<pubDate>Tue, 26 Feb 2008 12:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-154</guid>
		<description>Hi,

I've been using Hibernate rather reluctantly for the past 6 months and I still find it highly unusable (it is a client requirement).

I've written several ORMs before, and I always prefer to follow the developer's way of thinking rather than inventing my own, as I think is happening with HIbernate. I have one that is open source. It is based on several design patterns and it tries to respect the database way of doing things. 

Do you want to give it a try?

Cheers,
Guillermo.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve been using Hibernate rather reluctantly for the past 6 months and I still find it highly unusable (it is a client requirement).</p>
<p>I&#8217;ve written several ORMs before, and I always prefer to follow the developer&#8217;s way of thinking rather than inventing my own, as I think is happening with HIbernate. I have one that is open source. It is based on several design patterns and it tries to respect the database way of doing things. </p>
<p>Do you want to give it a try?</p>
<p>Cheers,<br />
Guillermo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaspreet</title>
		<link>http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/comment-page-1/#comment-125</link>
		<dc:creator>Jaspreet</dc:creator>
		<pubDate>Thu, 27 Dec 2007 22:57:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gtuhl.com/2007/12/19/hibernate-criteria-api-bug/#comment-125</guid>
		<description>Simple and to the point!</description>
		<content:encoded><![CDATA[<p>Simple and to the point!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
