How to insert DateTime with HQL
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi guys,
Im having some troubles while trying to make an insert from a select with HQL.
How can i make this in HQL
for example
insert into A (name,date1)
select p.name,to_date(<string>,<format>)
from person p
¿ Is there an equivalent "to_date" for HQL ?
Thanks in advance
leo
Im having some troubles while trying to make an insert from a select with HQL.
How can i make this in HQL
for example
insert into A (name,date1)
select p.name,to_date(<string>,<format>)
from person p
¿ Is there an equivalent "to_date" for HQL ?
Thanks in advance
leo
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Try something like this
or some other time function
or some other time function
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You should not need a function. Just use parameter binding.
leo osst
Greenhorn
Posts: 4
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
thanks guys...
i'll try that.
i'll try that.
leo osst
Greenhorn
Posts: 4
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i have the same problem.
Is there a way to make a date in INSERT....SELECT <here_i_want_to_make_date>
for Example
as new DateTime()
Is there a way to make a date in INSERT....SELECT <here_i_want_to_make_date>
for Example
as new DateTime()
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
And did parameter binding not help?
leo osst
Greenhorn
Posts: 4
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Parameter binding didn't work.
I ve read that parameters binding only works in where clause.
I 've tried this
Query query = session.createQuery(insert into A (name,date1)
select p.name,:myDate
from person p )
.setParameter("myDate",myCorrectDate);
When HQL Parser tries to parse that, it shows me
It seems that :myDate is not part of select clause
Any ideas how to solve this?
Thanks
I ve read that parameters binding only works in where clause.
I 've tried this
Query query = session.createQuery(insert into A (name,date1)
select p.name,:myDate
from person p )
.setParameter("myDate",myCorrectDate);
When HQL Parser tries to parse that, it shows me
It seems that :myDate is not part of select clause
Any ideas how to solve this?
Thanks
| Beware the other head of science - it bites! Nibble on this message: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |











