select « Composite « JPA Q&A





1. HIbernate+JPA Composite Key problem: generating select sql with wrong columns    stackoverflow.com

Here is my sample codes. PrimaryKey Class:

public class ReplAreaElemDataCompositeKey implements Serializable{

private static final long serialVersionUID = 1L;    
private int imageElementID; 
private int variableID;

public ReplAreaElemDataCompositeKey() {
    super();
}

/**
 ...

2. Select count() problems in HQL iwth composite-id    forum.hibernate.org

...

3. N+1 select with composite-id and many-to-one    forum.hibernate.org

Hibernate version: 2.1.8 Mapping documents: ...

4. Select based of ONE of the fields of a composite-id    forum.hibernate.org

Hi, I'm using Hibernate 3.0.5. I would like to create a Criteria, Query or .... that results in a Collection. The selection is based on one of the fields of the composite-id How to make such a Criteria. My Mapping file: Code: ...

5. select column of composite key    forum.hibernate.org

Newbie Joined: Fri Sep 30, 2005 5:10 pm Posts: 3 I'm using Hibernate 3.0 with Spring layered on top of it. DB2. I have a legacy table that needed to have a composite class defined for the key. Now I want to select one of the columns of the composite key in a query but getting QueryException saying could not resolve ...

6. INSERT INTO ... SELECT ... and composite-id problem    forum.hibernate.org

Hi, I've got INSERT INTO ... SELECT ... problems. When I try to class my statemet, I've got following exception: org.hibernate.QueryException: can only generate ids as part of bulk insert with either sequence or post-insert style generators I put all parts of composite-id into values list of insert statement: insert into IdfKlient(idKlient,dotazID,tabulkaVSabloneID,...... Is it possible to INSERT INTO ... SELECT ... ...

7. Immediate help pls. Need to select list of composite element    forum.hibernate.org

Immediate help needed please. I want to select list of composite element In main object 'A' I have /** * @hibernate.list * table="tab_b" * @hibernate.collection-composite-element * class="com.db.B" * @hibernate.collection-index * column="idx" * @hibernate.collection-key * column="b_id" */ Now I am trying simply "SELECT b from A a LEFT JOIN a.B b where a.id=?" But It does not works. javax.servlet.ServletException: could not resolve ...

8. select distinct composite id property    forum.hibernate.org

I am trying to do a select distinct for a column in a table. The problem is that the column is part of a composite key so the hibernate query only return one result instead of a list with the different values for that column. select distinct cn.primaryKey.property from ClassName cn How can I write the hql to return all values ...

9. Select before insert with composite-id    forum.hibernate.org

Hibernate version: 3.2.3 Mapping documents: Ticket.hbm.xml: Permission.hbm.xml: Name and version of the database you are using: MySQL 5.0 The generated SQL (show_sql=true): Hibernate: insert ...