getting single result from DB

Hello Vaadin Team!

How can I get a single result from database?
For example, if I have the following query and I want to write the result into a label and put it on my root layout.

SELECT SUM(Days) FROM HolidayEntry WHERE StaffNo = '1234' AND FromDate > '2011-01-01 00:00:00.000' and ToDate < '2013-01-01 00:00:00.000';

I’ve already tried to do it with a TableQuery or FreeFormQuery and SQLContainer but I didn’t get any Items back.

Thanks in advance for your help!


I have the same problem here.
I got a table with some id and some values.

And i just want to display the value of the id x in a label
LABEL <= SELECT value FROM valuetable WHERE id = 10;

If you have single record returned ( if id is a primary key, thats what should happen), then get the result using java sql statement, get the result set, get the first value in a string as rs.getString(1) & use it as the caption of the label

I got a SQLContainer, but only want to just get one specific row and column.
And is there some way to use a foreach on a SQLContainer ?