Container filters wihen using J2EEConnectionPool

Hello,
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.

Thanks,
Jacob


Code
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))

Hello,

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

Hi,

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:

/Jonatan

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

[code]

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

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

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

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

[/code]

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
Scott

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

http://dev.vaadin.com/ticket/7470