-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL insert of composed objects
PostPosted: Thu Feb 05, 2009 7:18 am 
Newbie

Joined: Thu Feb 05, 2009 5:22 am
Posts: 2
I was wondering whether it is possible to make an HQL insert of composed objects.
I mean, according to the Hibernate Reference, you can execute statements like this:
Code:
"insert into DelinquentAccount (id, name) select
c.id, c.name from Customer c where ..."

But, what if you have a composed object, like the one exposed in the 8th chapter of the same book:
Code:
<class name="eg.Person" table="person">
    <id name="Key" column="pid" type="string">
        <generator class="uuid"/>
    </id>
    <property name="birthday" type="date"/>
    <component name="Name" class="eg.Name">
        <property name="initial"/>
        <property name="first"/>
        <property name="last"/>
    </component>
</class>

?
Would it be possible to do something like this (1):
Code:
insert into Person (Key, birthday, Name.initial, Name.first, Name.last) select c.id, c.birthday, c.initial, c.firstname, c.lastname from Customer c where ...
?

I am currently working in a project where initial bulk loads of objects will be necessary. I have thought of this feature because it would be very convenient for such scenarios.

Thanks in advance.

(1) Since I am a born optimist, I have tried a similar HQL statement just to see if that worked. Not surprisingly, it did not.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.