SQLContainer

Hi
I want to realize the CRUD by using SQLcontariner with Mysql table

try {
			TableQuery q1 = new TableQuery("empinfo", connectionPool);
			q1.setVersionColumn("Version");
			q1.setDebug(true);
			employeeContainer = new SQLContainer(q1);
		} catch (SQLException e) {
			e.printStackTrace();
		}
SQLContainer datasource = new DatabaseHelper().getEmployeeContainer();
employeeTable = new Table();
employeeTable.setContainerDataSource(datasource);

when i open this application in brower, the console would display:

DB → begin transaction
DB → SELECT * FROM empinfo ORDER BY “EmployeeId” ASC LIMIT 1 OFFSET 0
DB → commit
DB → begin transaction
DB → SELECT * FROM empinfo ORDER BY “EmployeeId” ASC LIMIT 1 OFFSET 0
DB → commit
Fetching count…
DB → begin transaction
DB → SELECT COUNT(*) FROM empinfo

why
“DB → begin transaction
DB → SELECT * FROM empinfo ORDER BY “EmployeeId” ASC LIMIT 1 OFFSET 0
DB → commit” twice???

and aslo when i click the table header to ordre,the console would display:
Fetching count…
DB → begin transaction
DB → SELECT COUNT(*) FROM empinfo
DB → commit
DB → begin transaction
DB → SELECT * FROM empinfo ORDER BY “Name” DESC LIMIT 200 OFFSET 0
DB → commit
Does this operation need a qurey database? If so, will the communication volume increase?

Thanks!

Yes it does. SQLContainer works lazily, meaning that when you have large datasets, the container only fetches a small subset of the entire dataset. For example, consider a case where you have 10 000 rows in your table. The table fetches the first 200 rows. If you now reorder the container, the container cannot know where those 200 rows it has in-memory should be placed after reordering, hence it needs to do a new query to the database, having the database do the sorting and returning the first 200 rows after the sorting is done.

PS. Please try to be a bit more descriptive when choosing a subject for your forum posts.