[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3434) hql insert doesn't work when inserting into a table with composite-id

Graham Collinson (JIRA) noreply at atlassian.com
Tue Jul 28 06:15:12 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33675#action_33675 ] 

Graham Collinson commented on HHH-3434:
---------------------------------------

Oops.  Should have said that my patch was against 3.3.1.GA

>  hql insert doesn't work when inserting into a table with composite-id
> ----------------------------------------------------------------------
>
>                 Key: HHH-3434
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3434
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.6
>         Environment: 3.2.6GA, any database 
>            Reporter: Ning Zhang
>         Attachments: IntoClause.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list