Actually, that's easy to do: insert into AnObject(First, Second, Third) select a.First, a.Second, b from AnotherObject a, ThirdObject b where b.id = :thirdObject
IMO, using "where b = :thirdObject" should also work, but it generates invalid SQL (unqualified Id property) You can pass either the id or an entity/proxy as the parameter. If Fabio or other committer is reading, can you confirm if that's a bug or an expected behavior? Diego On Sun, Jun 13, 2010 at 14:18, Muhammad Shehabeddeen < [email protected]> wrote: > The problem is if Third is an actual object where if it was possible to use > binding parameters I would have used SetEntity to set the value. > > > > On Sat, Jun 12, 2010 at 3:51 AM, Diego Mijelshon > <[email protected]>wrote: > >> You can't use parameters in the select list, but you can use literals. >> >> insert into AnObject(First, Second, Third) >> select First, Second, 'Literal String' from AnotherObject >> >> Diego >> >> >> >> On Fri, Jun 11, 2010 at 15:37, MSD <[email protected]>wrote: >> >>> Can we use parameters in an Insert Select hql that would be executed >>> using ExecuteUpdate. The parameter is to be used in the Select part >>> for example: >>> "insert into AnObject (first, second, third) >>> select from AnotherObject (first, second, :paramThird)" >>> >>> the we use SetParameter to set paramThird. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<nhusers%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
