P
P
Pavel Dudenkov2016-05-06 18:52:14
Java
Pavel Dudenkov, 2016-05-06 18:52:14

Is it possible to pull one column into a String via addEntity(String.class)?

The bottom line is that the native query is written to return exactly one Yes/No value.
Therefore, I would like to pull out this value in some more beautiful way than:

String result = (String) (((Object[]) list.get(0))[0]);

I was thinking about:
Query query = session.createSQLQuery(queryToExecute).addEntity(String.class);

but nothing came of it. Maybe someone knows how to do it. I don't want to create a single field dummy class just for the sake of it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question