CollectionOfElements « Query « JPA Q&A

1. Hibernate: Query entities which contain a specified element in a CollectionOfElements?

Let's say I have this entity (for Hibernate):

public class Person {
    @GeneratedValue(strategy = GenerationType.AUTO)
    Long id;


2. How to create custom query for CollectionOfElements

I have problems creating a custom query. This is what entities:

public class ApplicationProcess {

private Set defaultTemplates; //more fields ...

3. Hibernate: Criteria API: Query entities which do not contain a specified element in a CollectionOfElements?

Let's say I have the following two classes; User and Location. I want to create a DetachedCriteria to query the user table, and return all users who do not have a ...

5. HQL for querying a CollectionOfElements

Hi, I have some problems in finding the correct HQL statement for an actual easy query. I have an object "User" with some attributes like username, password and with a Set of aliases that are mapped as as CollectionOfElements. The mapping looks like Code: public class User { private String username; private String password; ...

6. Selecting Entities based on CollectionOfElements

Newbie Joined: Tue Feb 02, 2010 2:41 pm Posts: 1 Location: Austin, TX I am trying to optimize Hibernate queries for my data model. It is really basic data model for ARTICLE that contains a @CollectionOfElements ARTICLE_FACETS but when I query on articles EVERY QUERY takes > 30sec to complete. Basically this code worked fine in the beginning, but as our ...

7. CollectionOfElements in query

I'm blown away by how much time I've wasted on this and I'm not any closer to a solution...I know I'm doing something really stupid. Here is my query: SELECT carrier FROM Carrier carrier WHERE carrier.owningEnterprise.HID IN (?1) AND IN (?2) is a CollectionOfElements (String), and I'm binding an ArrayList to the 2nd parameter. I end up blowing up ...

8. CollectionOfElements and IN clause

select as id7_, user0_.email_id as email10_7_, user0_.login as login7_, user0_.password as password7_, from ...

9. Query on CollectionOfElements

10. Can I restrict a CollectionOfElements with a where clause?

Hi, I am using hibernate annotations. I can't modify the table definitions. I have the following tables: CLIENT with columns (CLIENT_ID, NAME, ADDRESS). QUEUE with columns (CLIENT_ID, QNAME, IPADDRESS, ACTIVE) A client has multiple queues, but each queue has multiple IPADDRESSes, therefore there may be multiple records in QUEUE with the same QNAME -but different IPADDRESS). I don't need to maintain ...