[hibernate-commits] Hibernate SVN: r14053 - in core/branches/Branch_3_2: test/org/hibernate/test/filter and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Oct 3 00:55:03 EDT 2007
Author: steve.ebersole at jboss.com
Date: 2007-10-03 00:55:03 -0400 (Wed, 03 Oct 2007)
New Revision: 14053
Modified:
core/branches/Branch_3_2/src/org/hibernate/sql/Template.java
core/branches/Branch_3_2/test/org/hibernate/test/filter/Category.hbm.xml
core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java
core/branches/Branch_3_2/test/org/hibernate/test/filter/defs.hbm.xml
Log:
HHH-2593 : filter conditions using UNION (or MINUS) subqueries
Modified: core/branches/Branch_3_2/src/org/hibernate/sql/Template.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/sql/Template.java 2007-10-03 04:54:42 UTC (rev 14052)
+++ core/branches/Branch_3_2/src/org/hibernate/sql/Template.java 2007-10-03 04:55:03 UTC (rev 14053)
@@ -48,6 +48,8 @@
KEYWORDS.add("some");
KEYWORDS.add("exists");
KEYWORDS.add("all");
+ KEYWORDS.add("union");
+ KEYWORDS.add("minus");
BEFORE_TABLE_KEYWORDS.add("from");
BEFORE_TABLE_KEYWORDS.add("join");
Modified: core/branches/Branch_3_2/test/org/hibernate/test/filter/Category.hbm.xml
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/filter/Category.hbm.xml 2007-10-03 04:54:42 UTC (rev 14052)
+++ core/branches/Branch_3_2/test/org/hibernate/test/filter/Category.hbm.xml 2007-10-03 04:55:03 UTC (rev 14053)
@@ -6,21 +6,24 @@
<hibernate-mapping package="org.hibernate.test.filter">
<class name="Category" table="CATEGORY">
- <id name="id" column="CAT_ID" >
- <generator class="native"/>
- </id>
+ <id name="id" column="CAT_ID">
+ <generator class="native"/>
+ </id>
- <property name="name" type="string"/>
- <property name="effectiveStartDate" column="eff_start_dt" type="java.util.Date"/>
- <property name="effectiveEndDate" column="eff_end_dt" type="java.util.Date"/>
+ <property name="name" type="string"/>
+ <property name="effectiveStartDate" column="eff_start_dt" type="java.util.Date"/>
+ <property name="effectiveEndDate" column="eff_end_dt" type="java.util.Date"/>
- <set cascade="none" inverse="true" name="products" table="PROD_CAT">
- <key column="CAT_ID"/>
- <many-to-many column="PROD_ID" class="Product"/>
- </set>
+ <set cascade="none" inverse="true" name="products" table="PROD_CAT">
+ <key column="CAT_ID"/>
+ <many-to-many column="PROD_ID" class="Product"/>
+ </set>
- <filter name="effectiveDate" condition=":asOfDate BETWEEN eff_start_dt and eff_end_dt"/>
+ <filter name="effectiveDate" condition=":asOfDate BETWEEN eff_start_dt and eff_end_dt"/>
+ <filter name="unioned">
+ 'abc' in ( select d.reg from department d where (d.dept_id=123) union select p.name from sales_person p )
+ </filter>
- </class>
+ </class>
</hibernate-mapping>
\ No newline at end of file
Modified: core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java 2007-10-03 04:54:42 UTC (rev 14052)
+++ core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java 2007-10-03 04:55:03 UTC (rev 14053)
@@ -67,6 +67,13 @@
return new FunctionalTestClassTestSuite( DynamicFilterTest.class );
}
+ public void testSqlSyntaxOfFiltersWithUnions() {
+ Session session = openSession();
+ session.enableFilter( "unioned" );
+ session.createQuery( "from Category" ).list();
+ session.close();
+ }
+
public void testSecondLevelCachedCollectionsFiltering() {
TestData testData = new TestData();
testData.prepare();
Modified: core/branches/Branch_3_2/test/org/hibernate/test/filter/defs.hbm.xml
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/filter/defs.hbm.xml 2007-10-03 04:54:42 UTC (rev 14052)
+++ core/branches/Branch_3_2/test/org/hibernate/test/filter/defs.hbm.xml 2007-10-03 04:55:03 UTC (rev 14053)
@@ -27,4 +27,8 @@
<filter-def name="cat">
<filter-param name="catId" type="long"/>
</filter-def>
+
+ <filter-def name="unioned">
+ </filter-def>
+
</hibernate-mapping>
\ No newline at end of file
More information about the hibernate-commits
mailing list