[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2692?page=c...
]
Alvin Lim commented on HHH-2692:
--------------------------------
I have a similar problem.
SELECT a.id, b.name, :date
FROM tab1 a, tab2 b
WHERE a.id = b.id
AND a.date < :date
The named parameter :date can't be used in the SELECT clause. I can't use a
sub-select here, as it may not be the case that the parameter value will exist in table a
or b.
In my opinion, this feature should ideally be implemented by creating a new HQL function
which works as follows:
SELECT a.id, b.name, NEWFUNCTION(:toDate)
FROM ....
Is there an existing function that works the same way? I can't think of any other
workaround for this problem, other than creating a new Hibernate mapping to a new table
with a single row then inserting the parameter value into the row (which is even more
stupid :D)
Insert Into Select command doesn't allow named parameter as
select output (insert input)
----------------------------------------------------------------------------------------
Key: HHH-2692
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2692
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4.sp1 with Annotations 3.3.0 And Validator 3.0.0
MySQL 5.0.42
Reporter: John Aylward
receive exception:
org.hibernate.QueryException: number of select types did not match those for insert
[INSERT INTO ProviderInvoiceLineItem
(amount,billingAccount,circuit,description,invoice,type) SELECT pili.amount,
pili.billingAccount, pili.circuit, pili.description, :newInvoice, pili.type FROM
com.cicat.bedrock.billing.model.ProviderInvoiceLineItem pili WHERE pili.invoice =
:oldInvoice]
Idea is to copy all line items from one invoice to another. In other words, only
difference between data should be the invoice. easiest way to do this is with "insert
into" command and passing parameter of changed value.
* Trying to cast named parameter (:newInvoice) caused parsing error
* Trying to replace invoice with invoice_id and repacing :newInvoice with actual invoice
id resulted in a "property 'invoice_id' not found" exception
Should be able to set a value through a named parameter
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira