SQLContainer contains some null values

I have a function with freeformquery that load some data from db.
When the table show me the data, i see the image in the attachment.
If I scroll the table, the other data is ok.
The data on the db is ok.

Here my code:



//cp is the connectionpool
//ffqo is my delegate

String primaryKeyColumn= "ID"+codeName;
			FreeFormQueryASD ffqo = new FreeFormQueryASD();
			ffqo.setSQL(sql);
			ffqo.setNomeColonnaId(primaryKeyColumn);
			
			FreeformQuery ffq = new FreeformQuery(sql, cp, primaryKeyColumn);
			ffq.setDelegate(ffqo);
			
			SQLContainer c = new SQLContainer(ffq);
			
			c.commit();
			
			return c;

And my table code:

tbl = new Table();
			tbl.setContainerDataSource(c);
			tbl.setSizeFull();
			tbl.setColumnCollapsingAllowed(true);
			tbl.setColumnReorderingAllowed(true);
			tbl.setSelectable(true);
			tbl.setPageLength(20);
			tbl.setNullSelectionAllowed(false);
			tbl.setValue(tbl.firstItemId());

The same code and the same sql on other tables is ok.
12538.png

The above case gave me “Failed fetching page” error, so I implemented getContainsRowQueryStatement, but I have the weird behaviuor above: in my db table I have 254 rows, but the first 54 are not loaded in the table. If I do sqlcontainer.setPageLenght(400) it works because sqlcontainer can load every row.

If I want to load the last 54 rows leaving the default pagelenght, how can I do?

Can someone explain me?