From a06cc89cdbded874a3f96a8b52f759ac07672f34 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Thu, 28 Jul 2016 15:20:59 +0300 Subject: [PATCH] HHH-11002 - Add documentation section about Filter and FilterDef Remove @Where clause on collection since it does not work on this branch --- .../chapters/domain/basic_types.adoc | 34 ++----------------- .../userguide/mapping/basic/WhereTest.java | 10 ------ 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc index b601e05e36..9a635fe6a7 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc @@ -84,20 +84,6 @@ To use these hibernate-java8 types just add the `hibernate-java8` dependency to See <> for more about Java 8 Date/Time types. ==== -.BasicTypes added by hibernate-spatial -[cols=",,,",options="header",] -|================================================================================================= -|Hibernate type (org.hibernate.spatial package) |JDBC type |Java type |BasicTypeRegistry key(s) -|JTSGeometryType |depends on the dialect | com.vividsolutions.jts.geom.Geometry |jts_geometry, or the classname of Geometry or any of its subclasses -|GeolatteGeometryType |depends on the dialect | org.geolatte.geom.Geometry |geolatte_geometry, or the classname of Geometry or any of its subclasses -|================================================================================================= - -[NOTE] -==== -To use these hibernate-spatial types just must add the `hibernate-spatial` dependency to your classpath _and_ use a the `org.hibernate.spatial.SpatialDialect`. -See <> for more about spatial types. -==== - These mappings are managed by a service inside Hibernate called the `org.hibernate.type.BasicTypeRegistry`, which essentially maintains a map of `org.hibernate.type.BasicType` (a `org.hibernate.type.Type` specialization) instances keyed by a name. That is the purpose of the "BasicTypeRegistry key(s)" column in the previous tables. @@ -1229,8 +1215,8 @@ The SQL fragment can be as complex as you want and even include subselects. [[mapping-column-where]] ==== @Where -Sometimes, you want to filter out entities or collections using a custom SQL criteria. -This can be achieved using the `@Where` annotation, which can be applied to entities and collections. +Sometimes, you want to filter out entities using a custom SQL criteria. +This can be achieved using the `@Where` annotation, which can be applied to entities, as you can see in the following mapping. [[mapping-where-example]] .`@Where` mapping usage @@ -1273,22 +1259,6 @@ include::{extrasdir}/basic/mapping-where-entity-query-example.sql[] ---- ==== -When fetching the `debitAccounts` or the `creditAccounts` collections, Hibernate is going to apply the `@Where` clause filtering criteria to the associated child entities. - -[[mapping-where-collection-query-example]] -.Traversing collections mapped with `@Where` -==== -[source, JAVA, indent=0] ----- -include::{sourcedir}/basic/WhereTest.java[tags=mapping-where-collection-query-example] ----- - -[source, SQL, indent=0] ----- -include::{extrasdir}/basic/mapping-where-collection-query-example.sql[] ----- -==== - [[mapping-column-filter]] ==== @Filter diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/WhereTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/WhereTest.java index ef8628e333..a6d7b0d355 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/WhereTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/WhereTest.java @@ -88,14 +88,6 @@ public class WhereTest extends BaseEntityManagerFunctionalTestCase { assertEquals( 2, accounts.size()); } ); //end::mapping-where-entity-query-example[] - - //tag::mapping-where-collection-query-example[] - doInJPA( this::entityManagerFactory, entityManager -> { - Client client = entityManager.find( Client.class, 1L ); - assertEquals( 1, client.getCreditAccounts().size() ); - assertEquals( 1, client.getDebitAccounts().size() ); - } ); - //end::mapping-where-collection-query-example[] } //tag::mapping-where-example[] @@ -112,11 +104,9 @@ public class WhereTest extends BaseEntityManagerFunctionalTestCase { private String name; - @Where( clause = "account_type = 'DEBIT'") @OneToMany(mappedBy = "client") private List debitAccounts = new ArrayList<>( ); - @Where( clause = "account_type = 'CREDIT'") @OneToMany(mappedBy = "client") private List creditAccounts = new ArrayList<>( );