Container filters wihen using J2EEConnectionPool

I’m using J2EEConnectionPool from tomcat 7 Datasource. But when I create SQLContainer using this datasource I’m unable to use Container Filters or Container Orderby. When I use the same code with SimpleJDBCConnectionPool the filtering and sorting works. Do you know why this happens? Is the sorting and filtering only supported by SimpleJDBCConnectionPool. Both the datasource and SimpleJDBCConnectionPool connects to the same MySQL database.


JDBCConnectionPool pool = new J2EEConnectionPool(“java:comp/env/jdbc/ossmtoolweb”);

TableQuery query = new TableQuery(“nodes”,pool);

SQLContainer container = new SQLContainer(query);
container.addContainerFilter(new Equal(“hostname”, hostname));
container.addOrderBy(new OrderBy(“hostname”, false))


I ran into the same problem and I am interested if there is a solution for that issue…
(vaadin 6.6.4, SQLContainer 1.1.0)

Thanks in advance


Unfortunately it’s really hard to help without some more information. In what way doesn’t filtering or sorting work when using J2EEConnectionPool? Do you get exceptions?

I don’t see how switching between ConnectionPool implementations would affect filtering or sorting without also affecting everything else.

Are you using TableQueries or FreeformQueries?

Need more info :slight_smile:


I am using vaadin (6.6.4) with SQContainer (1.1.0) in a portlet deployed in liferay.
My vaadin application init method looks like


public void init() {
Window mainWindow = new Window(“LaboVaadinappApplication”);

	try {
		JDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool(
		        "jdbc:mysql://localhost:3306/test", "test", "test", 2, 5);
		TableQuery tq = new TableQuery("matches", connectionPool);
		final SQLContainer container = new SQLContainer(tq);
		container.addContainerFilter(new Equal("leagueShortcut", "cl"));
		Table t = new Table();
		//Test the dataSource
		Connection con = dataSource.getConnection();
		String driverVersion = con.getMetaData().getDriverVersion();
		JDBCConnectionPool cp = new J2EEConnectionPool(dataSource);		
		TableQuery tq1 = new TableQuery("matches", cp);
		final SQLContainer container1 = new SQLContainer(tq1);

// container1.addContainerFilter(new Equal(“leagueShortcut”, “cl”));
Table t1 = new Table();

		mainWindow.addComponent(new Label("SimpleJDBCConnectionPool 2/5"));
		mainWindow.addComponent(new Label("J2EEConnectionPool " + driverVersion));
	} catch (SQLException e) {
		// TODO Auto-generated catch block


My DataSource is defined as Spring Bean in context xml and autowired in the vaadin application.
(Autowiring works since the test code for the connection works)
The Table with the J2EEConnectionPool works in case above but when I uncomment the line

container1.addContainerFilter(new Equal("leagueShortcut", "cl"));

that it looks like the table with the SimpleJDBCConnectionPool no rows are returned.

If it is helpful I can provide you the complete source code incl. build script…

I am wondering that it seems that nobody else run into that problem.
Can somebody give me a hint if there is any error in my example code ?
Can anybody provide me a running example with a SQLContainer, J2EEConnectionPool and Filtering support example ?

Thanks in advance

Seems to be a bug, I opened a ticket for that issue