tags:

views:

48

answers:

1

i have an sql query that has one unnamed column as a list of strings.

my hbm is declared as follows:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Services.Data"  namespace="Services.Data" >
  <sql-query name="GetDiagramSubscriptions">
    exec Diagram_Subscriptions:contactId
  </sql-query>
</hibernate-mapping>

my repository method:

IQuery query = Session.GetNamedQuery("GetDiagramSubscriptions")
            .SetInt32("contactId", contactId)
            .SetResultTransformer(Transformers.AliasToBean<string>());

return query.List<string>();

this doesn't work because type string doesn't have a setter.

i don't want to declare a mapping class just for this one column. is there a way to transform this to a Tuple or something?

+1  A: 

just remove this call .SetResultTransformer(Transformers.AliasToBean<string>()) and the List<string>() will do what you expect.

dotjoe
lol -- it works!thanks.
CurlyFro