Comments (3)
Are you saying that Filter.some("friends", Filter.in("id", Collection<X.id()>))
did
work successfully and gave you the results you wanted?
Also, what do you mean by the "Collection<...>" syntax?
I'm sorry that the usage is sort of confusing for these filters. Hopefully I
can get
some better examples up sometime. In the mean time, both of the following
options
should work for your case. If not, then there may be a bug in the framework.
Filter.some("friends", Filter.equal("", X);
Filter.some("friends", Filter.equal("id", X.getId());
There is also a blog entry that has some more examples: http://java-generic-
dao.blogspot.com/2008/12/search-capability-needs-to-be-able-to.html
Original comment by dwolvert
on 13 May 2009 at 7:23
from hibernate-generic-dao.
>Are you saying that Filter.some("friends", Filter.in("id",
Collection<X.id()>)) did
>work successfully and gave you the results you wanted?
Yes it does.
Collection<X.id()> is my shortcut of:
List<Integer> idList = new ArrayList<Integer>();
for (X x : getCollectionOfTypeX()) { idList.add(x.getId());}
search.addFilter(Filter.some("friends", Filter.in("id", idList))));
search.addFetch("friends")
this works well but is "ugly" code. I prefer the example of your blog entry:
Filter.some("friends", Filter.in("", collectionOfFriends))
I think it could be more distinguishable if you provide something like
Filter.in(Collection<?> collection).
BTW many thanks for this very helpfull framework.
Original comment by [email protected]
on 14 May 2009 at 5:16
from hibernate-generic-dao.
Will not change API. Will add more examples of Filters to the documentation.
Original comment by dwolvert
on 27 May 2009 at 6:47
- Changed state: WontFix
from hibernate-generic-dao.
Related Issues (20)
- How to use second_level_cache in hibernate-generic-dao HOT 2
- JPAAnnotationMetadata uses java 6 java.lang.String.isEmpty() method. search-1.1.0.jar is incompatible with java 5 HOT 3
- Hibernate 4 Upgrade HOT 3
- Entity not being saved HOT 2
- Implement MetadataUtil for JPA 2 metadata model
- JPAAnnotationMetadata only accepts direct public fields in getProps()
- Add Enumeration support to InternalUtil.convertIfNeeded()
- Version 1.1.3 InExpression can not handle values not null but without any elements
- Nested property fetches dont work (first identified in issue 56) HOT 1
- JPABaseDAO - java.lang.NoSuchMethodError HOT 2
- NoSuchMethodError HOT 2
- Sample Projects do have a wrong dao-hibernate version in their poms
- Sample Project hibernate-maven-web does nut run under jetty (?) HOT 1
- How to compare to fields using ==, <=, >= , > , < operators HOT 3
- Search.removeField(property) not work HOT 1
- UUID HOT 1
- GenericDAO Search failed with boolean Column HOT 2
- Not compatible with the latest hibernate
- Issue with Distinct with hibernate 4.3,5 HOT 1
- OP_LIKE is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hibernate-generic-dao.