Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
NHibernate version:
1.2
Mapping documents:
<sql-query name="updateTag">
UPDATE TAGS SET TAGID = :tagID, MATRICOLA = :matricola, DATA = GetDate()
FROM TAGS
WHERE TAGID = :oldTagID
</sql-query>
Name and version of the database you are using:
MS SQL SERVER 2005
Hallo. i would like to update a record on a table named Tags via a custom sql query.
As first way i tried to use the
<sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-update>
but in could not found any example on how to use this way from the code.
So I have tried namedQuery as the one above but i cannot find a way to execute it like in Hibernate, the only way to execute is:
IQuery query = session.GetNamedQuery("updateTag");
query.SetParameter("tagID", "9999999999999999");
query.List();
And obviously i get the exception
NHibernate.QueryException: Return types of SQL query were not specified
Any idea which is the simplest way to update a record using an HQL/SQL query?
Kind regards
Massimo