hql insert doesn't work when inserting into a table with composite-id

Description

I have a table serving as an association table, so the Id of the table is just the ids from the linked tables. The mapping file looks like:

<class name="UserPt" table="user_pt" >
<composite-id>
<key-property name="userId" type="java.lang.Long" column="user_id"/>
<key-property name="ptId" type="java.lang.Long" column="pt_id"/>
</composite-id>
</class>

And I need to run some HQL to insert the association into the table like:

INSERT INTO UserPt(userId, ptId) SELECT user.id, pt.id FROM...........

When I run this HQL, it gives an error saying:

"can only generate ids as part of bulk insert with either sequence or post-insert style generators".

I logged the bug in http://opensource.atlassian.com/projects/hibernate/browse/HHH-3400, but it is closed because I asked for a workaround. So this time I am not asking for anthing, just report the bug.

Environment

3.2.6GA, any database

Activity

Show:
Jan Haderka
December 22, 2010, 10:47 AM

Hi,
is this issue ever going to be fixed or is there a reason why attached patch can't be applied?
Thanks.

Graham Collinson
June 8, 2011, 1:08 PM

Just moved to hibernate 3.6.4.Final and my patch appears to still fix my problem. Did I miss something with my solution?
I'll provide a patch file for this release.

Andrei Badea
July 8, 2011, 2:43 PM

Fixing this would also resolve HHH-4596.

Except for providing patches (thanks Graham!) and voting, what else can we do to get this issue resolved?

Emmanuel Bernard
October 19, 2011, 11:54 AM

Thanks Andrei for the extra last mile and the other participants for your contributions. Sorry it took so long.

Brett Meyer
March 7, 2014, 10:09 PM

Bulk closing tickets resolved in released versions

Assignee

Emmanuel Bernard

Reporter

Ning Zhang

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure