Question: I have an MSSQL server and a function that return table value. I want to use it in my Grails application. Is there any straight way to do this?

For now I come to using an SQL query. Here code from controller

```
final curSession = sessionFactory.currentSession
final String query = 'SELECT * FROM [dbo].[someFunction] (params here)'
final sqlQuery = curSession.createSQLQuery(query)
//sqlQuery.addEntity(oot.Foo.class)
final List<FooCommand> results = sqlQuery.list()
[results:results]

```

If I do so I receive Array of Arrays in a view without any names of columns and it's not too convinient to operate with it.
If I create a **domain class** Foo that match select and uncomment the line `sqlQuery.addEntity(Foo.class)` I'll get exactly what I want, but in this case grails will create empty table `dbo.foo` which I would like to avoid.

I found that there are **Command Objects** in Grails which almost like domain but do not create underlying tables. Sounds like what I want. But when I use Command class instead Domain (`sqlQuery.addEntity(oot.FooCommand.class)`) I receive a **MappingException**

```
Unknown entity: oot.FooCommand. Stacktrace follows:
Message: Unknown entity: oot.FooCommand

```

Answer: 
I had same problem it was solved by addiing -lstdc++ in command line.
I had the same issue, in my case the problem was writing gcc instead of g++