Criteria « Search « JPA Q&A





1. Hibernate one-to-many search with Criteria    stackoverflow.com

I've got a Hibernate entity, called Event, which has a one-to-many metadata entity, EventData. Given the following Event: EventId: 1
EventHash: broccoli With the following EventDatas: EventDataId: 1
EventId:1
Field: tag
Content: tagme EventDataId: 2
EventId: 1
Field: tag
Content: anotherTag How ...

2. hibernate Criteria "fast" search    coderanch.com

Is there a way for me to do a following type search using hibernate Criteria/Restriction --- Table "School" has a column "dept_id". I have a big array of "dept_id", is there a way for me to get all the rows whose "dept_id" are contained in my array of "dept_id". If we use SQL, we have to use syntax "WHERE dept_id IN ...

3. Hibernate criteria search problem    coderanch.com

Hi! I'm using the Criteria api for building queries. Now I have bumped into a sorting problem. My Item class has a price and a discount. The Item class has a many to one relation with a Collection class. The Collection class also has a discount. The Items discount superseeds the collection discount. So when getting the discount in my class ...

4. Hibernate Search using Criteria with OR condition.    coderanch.com

Hi, I need to write a dynamic search querry in my Hibernate application. For the same I am using this Criteria API to build the querry dynamically bellow is code Criteria criteria = session.createCriteria("com.xx.beans.MyProfile").setMaxResults(51); if(searchRequestData.getEmailAddress()!=null && searchRequestData.getEmailAddress()!=""){ criteria.add(Expression.like("emailAdd","%"+searchRequestData.getEmailAddress()+"%" ));} if(searchRequestData.getFirstName()!=null && searchRequestData.getFirstName()!=""){ criteria.add(Expression.like("subsNumber", searchRequestData.getCirculationNameID())); } criteria.add(Restrictions.like("siteId",1); criteria.add(Restrictions.like("siteId",11); List searchResults= criteria.list(); When I run this querry, the querry its generating with AND ...

6. methods of search with criteria    forum.hibernate.org

hi everybody, i'm using criteria to find object from database i gave the primary key(String) and ask to retreive the corresponding object i used restrictions.eq() but it didn't work and restrictions.like() returns all the object that primary key looks like what i give can you tell me what method to use in order to retreive just the required object thank you. ...

7. Criteria Search of @Lob byte[]    forum.hibernate.org

Hi, I try to do a criteria search on a byte[] field persisted in mysql with @Lob annotation. I always get an empty result :( Is there a special way for submitting binary data to the criteria api? The byte[] field is persisting a mac address (6 bytes) Here the example: ======== annotated class ========== public class DhcpEntry { @Id @GeneratedValue ...

8. One-to-many search with Criteria    forum.hibernate.org

Hi all, I've got a Hibernate entity, called Event, which has a one-to-many metadata entity, EventData. Given the following Event: EventId: 1 EventHash: broccoli With the following EventDatas: EventDataId: 1 EventId:1 Field: tag Value: tagme EventDataId: 2 EventId: 1 Field: tag Value: anotherTag How do I create a Criteria query to retrieve the event which has BOTH tags "anotherTag" and "tagme"? ...

9. Criteria nested search    forum.hibernate.org

First off, congrats on the amazing effort by the Hibernate team. It's simplified our application in so many ways. I'm trying to use the Criteria API to search nested properties of a class. This is a topic that's been covered in this forum before, but I haven't found this PARTICULAR question. The simplest way to describe the problem would be to ...





10. Criteria Like Search For a Number    forum.hibernate.org

11. "No topics or posts met your search criteria"    forum.hibernate.org

As long as we're talking about the search page, I have a request just in case someone is still hacking up the PHP. This is an annoyance in phpBB that I've never been able to understand, and I'm not sure how much effort would be involved in changing it. Currently there are two search options: * Search topic title and message ...

12. Searching across multiple associates with Criteria?    forum.hibernate.org

Instructor has many Courses, courses have many Students. I'd like to use the Criteria API to search for all Instructors with a given Student. I don't know if it's legal to do something like someCriteria.createCriteria("x.y.z"); it doesn't give me an exception when I create the criteria but it does when it tries to actually do the search. What is the best ...

13. Searhing escape symbols using criteria based search    forum.hibernate.org

The org.hibernate.criterion.LikeExpression class can do this. There's a constructor that looks like this which gives you the ability to specify an escape character: protected LikeExpression( String propertyName, String value, Character escapeChar, boolean ignoreCase) Unfortunately it's protected. I just copied the source to a new class in one of my own packages and made the constructors public.

14. Criteria Search    forum.hibernate.org

class Car { private String name; private String description; private Set parts; } class Part { private String name; } List cats = sess.createCriteria(Car.class) .add( Restrictions.or(Restrictions.like("name", "F%") ), ...

15. Criteria search problems?    forum.hibernate.org

Hi, I have a slight or should I say "major" problem. I have an object A with a couple of properties but it also has an object B inside and Object B also has a couple of properties. If I want to use the Criteria API I would use the A.class and ad an expression however since they mapped I would ...

16. Criteria search needs help    forum.hibernate.org

public class Policy { private int id; private Product product; private int conversionAttempts; ... } public class Product{ private int id; private Date creationDate; ... }





18. criteria search: nested search    forum.hibernate.org

19. How to ignore html tags in a Criteria search    forum.hibernate.org

Hi all from Spain. I need to search with criteria over a varchar2 fiel that includes html tags. I would like to ignore the tags in my search. For example: If Ive got the text "Hello world" in the database field, and I search from my application by the text "strong" (using criteria ilike method) I`ll obtain "Hello world" as result. ...