hql « Collection « JPA Q&A





1. Hibernate dynamic instantiations with collections, is it possible?    stackoverflow.com

I would like to write a hql query using a dynamic instantiation with a list as one of it's parameters. Simplified example: A HQL query with a dynamic instantiation:

select new x.y.UserDto(u.name, u.contacts) from ...

2. Hibernate Collection chaining    stackoverflow.com

I have two Entities

University   
   courses

Course
   students
i want to access all the students in a university. I tried the following query
select u.courses.students from university u
i ...

3. Hibernate HQL and Grails- How do I compare collections?    stackoverflow.com

Hi everyone (my first post!), I have an HQL question (in Groovy/Grails) I was hoping someone could help me with. I have a simple Asset object with a one-to-many Tags collection. class Asset { ...

4. Checking the Intersection of Two Collections via HQL    stackoverflow.com

I have an class which has a collection, mapped as a bag in my nHibernate mapping file for that class, and I wish to return all instances of that class whose ...

5. Custom Fill Collection in NHibernate    stackoverflow.com

I'm using NHibernate in my web app and it is mapped with my database. I have a model, somthing like this:

public class Company {
   public virtual string Name { ...

6. HQL: Is an element of one collection in another collection?    stackoverflow.com

I want to check whether at least one element of a collection (u.organisations) is contained in another collection (? = excludedOrganisations): ...

7. Dereferencing collection Hibernate    stackoverflow.com

I have HQL query

SELECT contact.countryCode, contact.firstName, contact.familyName, **contact.accounts.country**
FROM
Contact contact, IN (contact.accounts)accounts 
WHERE
contact.gender = ? OR accounts.country = ?
and getting illegal attempt to dereference collection [contact0_.id.accounts] with element property reference [country]. Where, ...

8. What to do when your passing in a collection of zero into a hql request?    stackoverflow.com

I have this

     public List<TableA> Get(Guid Id, List<int> listId)
    {
        const string query = "FROM TableA WHERE ...

9. Hibernate AliasToBean with Collection    stackoverflow.com

I have a bi-directional one-to-many relationship defined between Parent and Child classes. I'm looking to execute a query such that I can return a single parent, and a subset of its ...





10. HQL on collections    forum.hibernate.org

I have the following Domain classes: Instructor Class School Instructors have a collection of Classes and a class is associated to a school. I need to be able to query for all instructors in a school. I've tried the following and it's not working: 'Select i from Instructor i, Course c where c.school = :school and c in elements(i.courses)' I've tried ...

11. Hierarchical object collection navigation not support in HQL    forum.hibernate.org

Hi, We have an organisation unit class that can be a parent to child organisation classes. We need to know for each object all the children and nested children. HQL doesn't support hierarchical queries so we have used a native oracle SQL CONNECT BY statement to retrieve a set of data using sql-query and load-collection in our mapping file. We can ...

12. HQL - Conditions on collections    forum.hibernate.org

I'm noticing some weird behaviour with HQL when I use implicit joins while referencing a collection. Take the following example query: Code: from Sample sample where sample.shipment.sampleCollection.size = (select count(*) from sample.shipment.sampleCollection samples where samples.name='Blood') in english: "give me all samples where the whole shipment contained only blood". For reasons i wont go into, the all keyword cannot be used. The ...

13. help with HQL and collections please    forum.hibernate.org

I have a customer object which has a collection of request objects. i want a query that will return all customers that have requests with a certain property - something like from Customer c WHERE elements(c.requests).property='value' unfortunately, the above does not work. Does anyone know how to acomplish this with HQL? thanks

14. HQL + Collections + one-to-many    forum.hibernate.org

I have a trouble driving me crazy. I have 2 objects: Enterprises and Segments and a one-to-many relationship between them. I have a primary key from a Segment (14) and need in just one step get all Entreprises with this segment. I try a lot of thinks buy can not do that. I need to filter some another properties of enterprise ...

15. How to constrain collection in HQL?    forum.hibernate.org

What i am trying to do is very simple but... My class Parent has a Map of children and I want to load the parent with only a subset of children. I am trying From Parent p left join fetch p.children where p = ? and p.children.elements = ? But i get a jdbc exception saying "more than one row returned ...





18. Simple HQL on a collection    forum.hibernate.org

19. HQL: is it possible to pass a collection as a parameter...    forum.hibernate.org

Hibernate version: 3.0.5 Name and version of the database you are using: MS SQLServer 2000 The problem: I am fetching objects whose properties I want to display in a web app: Code: select vk from VendorKeyword vk fetch all properties, ...

20. [org.hibernate.hql.PARSER] - illegal syntax near collection    forum.hibernate.org

Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message stevewickii Post subject: [org.hibernate.hql.PARSER] - illegal syntax near collection Posted: Tue Oct 10, 2006 12:37 pm Beginner Joined: Mon Apr 24, 2006 9:47 pm Posts: 33 Location: Kansas City, MO Hibernate version: 3.1.2 Mapping documents: Resource.hbm.xml ...

22. Intersection of Collections in HQL    forum.hibernate.org

Hi, I have two objects, say ObjectA and ObjectB that both have a list of objects C. I need to display any ObjectA objects where it's list of C objects intersects with ObjectB's list of C objects. My query looks something like this: Code: From ObjectA a where ? between a.date1 and a.date2 and ( (select c from a.cObjectList) in (select ...

23. HQL for min() over a referenced collection    forum.hibernate.org

24. Intersection of 2 collection using HQL    forum.hibernate.org

25. How to remove items from a collection by using HQL?    forum.hibernate.org

Hi all, I'm new to hibernate, trying to grasp the hibernate style of programming. I have a many to many relationship between the following entities DMap and MapablePoint: Code: @Entity(name = "Map") public class DMap { @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY) //@MapKey(targetElement = String.class) @JoinTable(name="map_mapable", ...

26. HQL and Collections    forum.hibernate.org