HHH-11002 - Add documentation section about Filter and FilterDef
Remove @Where clause on collection since it does not work on this branch
This commit is contained in:
parent
ca9084cb53
commit
a06cc89cdb
|
@ -84,20 +84,6 @@ To use these hibernate-java8 types just add the `hibernate-java8` dependency to
|
|||
See <<basic-datetime>> 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 <<spatial>> 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
|
||||
|
||||
|
|
|
@ -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<Account> debitAccounts = new ArrayList<>( );
|
||||
|
||||
@Where( clause = "account_type = 'CREDIT'")
|
||||
@OneToMany(mappedBy = "client")
|
||||
private List<Account> creditAccounts = new ArrayList<>( );
|
||||
|
||||
|
|
Loading…
Reference in New Issue