match « Query « JPA Q&A





1. NHibernate query for matching all tags    stackoverflow.com

Here are my relevant classes:

public class Item {
    public virtual int Id { get; protected set; }
    public virtual IList<Tag> Tags { get; set; }
}

public ...

2. Finding closest match for latitude and longitude with hibernate    stackoverflow.com

Lets say I get the user to pick long and lat on map. I have database with following fields:

zip
state
latitude
longitude
city
full_state

How do I retrieve the closest match for long and lat with hibernate HQL ...

3. JPA Select based on collection element match, or empty collection    stackoverflow.com

I have a Unit which has a UnitType and an Organization. I have a Contract which has a collection of UnitTypes and an Organization. I would like to select ...

4. Querying for entities that match a collection in Hibernate    stackoverflow.com

imagine I have two entities - Tag and Text where Text has multiple tags and there are several things I would like to do with them. I would be very happy ...

5. NHibernate HQL query for collection of values with multiple match values    stackoverflow.com

I'm trying to write an HQL (NHibernate 3.0) query for an entity that has a collection of values (strings). A much simplified entity:

public class Entity {
  public int Id { ...

6. (elegantly) Querying for number of matching days in JPQL    stackoverflow.com

In one of my projects I have the following situation: I have "Availability Objects" that have a starting date and an end date. Users query for these by defining a date range ...

7. JPA gives error on excuting named query using MySQL MATCH function    stackoverflow.com

Named Query goes thus: @NamedQuery(name = "Table.findFTS", query = "SELECT t FROM table t WHERE MATCH(t.field1, t.field2) AGAINST (':text' IN BOOLEAN MODE)") and the Error: Exception: Exception [EclipseLink-8025] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.JPQLException ...

8. JPQL: sort queryresult by "best matches" possible?    stackoverflow.com

I have the following question/problem: I'm using JPQL (JPA 2.0 and eclipselink) and I wanna create a query that gives me the results sorted the following way: At first the results sorted ascending ...

9. "Number of select types did not match those for insert"    forum.hibernate.org

Hi guys, im having some troubles when i try to make an insert with hql. This is an example of what im trying to do String hqlQuery = "insert into A (name,state) select name,:stateP from B"; Query query = session.createQuery(hqlQuery).setInteger("stateP",1); That piece of code throws me the following exception "Number of select types did not match those for insert" In Entity ...





10. HQL query: matching collections?    forum.hibernate.org

Hi, I'm trying to find an HQL statement for Hibernate 2.1.8/Oracle10g/Postgres that finds all entities whose collection of names matches a list of names (named parameter :names); the result set should only contain entities that have *all* names passed; pseudo HQL: from Entity e where :names all in elements( e.names ) :categories is of type String[]. The above statement isn't valid, ...

11. Collection subset match query    forum.hibernate.org

I am assuming that parent to value is many-to-many, and that there is a mapped Java class representing this relation called ValueToParent, with two fields called "valueRef" and "parentRef". Then I would try doing something like this: Code: select valueRef from ValueToParent where parentRef.id in (:parent_ids) group by ...

12. Criteria query: How to match inside a Set ?    forum.hibernate.org

I have looked at the documentation, but I could not find a similiar example..... I have a User class and a UserValue class. User.java public Set getUserValues(); Now I want to find all users who have a specific UserValue inside their UserValues. Criteria criteria = _session.createCriteria(User.class); criteria.add(Restrictions.eq("userValues",someValue)); ??? criteria.setMaxResults(30); List users = criteria.list(); Currently I am using: Query query = _session.createQuery("select ...

13. Querying collections to match a given set of values    forum.hibernate.org

Thanks for the reply. I tried that but still, it doesn't solve my issue. In my issue, I want to select the Owner object which has maching tags (String) for all of the Strings which I specify as parameters. For example, If I specify A,B,C as parameters, it should give me the set of Owner objects which has A, B and ...

14. HQL for finding all elements matching a subset?    forum.hibernate.org

Hi! I have a class File with a collection Keywords. How can I do a search for all files matching a every keyword given in a search? So for instance, if my search query was: hello goodbye, I'd have some pseudo HQL like: from Files f where ('hello', 'goodbye') all in elements(f.keywords) Any decent way for me to do this? Thanks ...