SQLContainer - Table with same row repeated

hello
I followed the various examples to link table of mySQL in a SQLcontainer.


try {
	Connection conn1 = myConnection.getConnectionPool().reserveConnection();
	Statement stmnt1 = conn1.createStatement();
	String query1 = new String("SELECT * FROM paf_Students  WHERE Paf_list_Students_idStudents = '"+getStudentData()+"'");
	FreeformQuery finalPafFreeFormQuery = new FreeformQuery(query1, myConnection.getConnectionPool(), "Paf_List_Students_idStudents");
	finalPafFreeFormQuery.setDelegate(new FinalPafFreeformQueryDelegate());
	finalPafContainer = new SQLContainer(finalPafFreeFormQuery);
        finalPafTable.setContainerDataSource(finalPafContainer);
        stmnt1.close();
        conn1.commit();
	myConnection.getConnectionPool().releaseConnection(conn1);
        } catch (SQLException e) {
			e.printStackTrace();
}

The problem is that i don’t see all the rows in the table, but only the last row repeated N times… why ?

It’s a well known error, or is needed the full source code?

(vaadin 660 + sqlcontainer 110)

Thanks in advance to all :slight_smile:
11734.png

Hi,

could you post your complete
query1
after line 5?

Are you sure that your query gets more than one different data record?

Yes, I’m sure.

Anyway, i find the error -.- … at FreeFormQuery i have indicated a column “Paf_list_Students_idStudents” that
did not contain a primary key
, but an equal number for all rows.
Now I have added a column with a primary key, and everything works properly.

Thanks Thorsten, problem solved. :wink: