SQLContainer information retrieval


I am trying to set up vaadin database connection with my LoginForm component and I am stuck with the username and password validation part of it. As you see at the code below buildContainer() method that access mysql database and retrieves the user table. The whole database connection process goes through well and there are no problems with either connections or the retrieval of the information. However, when I try to access the SQLContainer I am doing something wrong in the way I try to extract the data out of if. When I run the .size() the SQLContainer returns a size of the table which corresponds to the actual amount of rows in my table, and also when I run .getContainerPropertyIds() The SQLContainer again returns to me all of the proper names of the columns. However, when I try running .getItemIds() the SQLContainer returns a null. I would greatly appreciate if someone could instruct me on how to utilize the SQLContainer properly to retrieve the needed information.

Thank you,

import java.sql.SQLException;

import com.vaadin.data.util.sqlcontainer.SQLContainer;
import com.vaadin.data.util.sqlcontainer.query.FreeformQuery;
import com.vaadin.ui.*;
import com.vaadin.ui.LoginForm.LoginEvent;
import com.vaadin.ui.Window.Notification;

public class LoginPage extends VerticalLayout  {
	private LoginForm prm_login = new LoginForm();
	private Panel prm_loginPanel = new Panel("Login");
	private Pakit prm_app;
	public LoginPage(Pakit arg_app) {
		prm_app = arg_app;
		prm_login.addListener(new LoginForm.LoginListener() {
            public void onLogin(LoginEvent event) {
            	SQLContainer lcl_sqlContainer = buildContainer();
            	if (lcl_sqlContainer.getContainerProperty(0, 0).getValue() == event.getLoginParameter("username") &&
            		lcl_sqlContainer.getContainerProperty(0, 0).getValue() == event.getLoginParameter("password")){
            		getWindow().showNotification("Login Unsuccessful<br/>",
            		"Username: " + event.getLoginParameter("username") + "<br/>" 
            		+ "Your login information was not found in our records.",
		prm_loginPanel.setStyleName("borderless bubble");
        setComponentAlignment(prm_loginPanel, Alignment.MIDDLE_CENTER);

	public LoginForm getLoginForm(){
		return prm_login;
	public SQLContainer buildContainer(){
		try {
			SQLContainer lcl_sqlContainer = new SQLContainer(new FreeformQuery(
					"SELECT * FROM pakit.user",prm_app.getDatabaseConnect().getConnectionPool()));
			return lcl_sqlContainer;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
		return null;

After doing some research this is where I am at and what I think the problem is. It seems that when I run the .getPrimaryKeyColumns() on my query the print out is
which soft of points out the problem. As I understood the SQLContainer giver ItemIDs using the primary key, however in my case the primary key is never assigned/selected properly by the FreeformQuery(). If there is someone who understands what I am talking about, I would greatly appreciate you assistance.

FreeformQuery lcl_query = new FreeformQuery("SELECT * FROM pakit.user",prm_app.getDatabaseConnect().getConnectionPool());

Made some more progress and used this deprecated form of FreeformQuery() which started assigning the proper ItemIDs.

FreeformQuery lcl_query = new FreeformQuery("SELECT * FROM pakit.user",Arrays.asList("ID"),prm_app.getDatabaseConnect().getConnectionPool());

However, when I try to access these IDs lcl_sqlContainer.getItem(“1”) I get null as a reply.

Solved the problem.

This is how it is done.

lcl_sqlContainer.getContainerProperty((new RowId(new Object[]{1})), "USERNAME").getValue()