Oracle SQLContainer...

Hi,

i am new to Vaadin and have a problem with my oracle connection!
Atm I am planning a Java Web Framework comparison for the company I work for, for future projects. Vaadin is in my range, so I am trying to play around with it.
Most important for us is, that we have tables with around 60 columns and about 5000 rows! So I am building a Table atm with vaadin and an oracle connection… this seems to be harder than expected. Sadly!

I follwed the Tutorial and get Stuck in setting the SQL Container!
It always says: Ids must exist in the Container or as a generated column , missing id: x

It returns me the rowcount etc. etc. … but it wont create a layout or sth. because of this error… how can I solve this?

I am sorry for that question if it is easy, but I really don’t know by your tutorial what i am doing wrong…

here is my code…

In my Application ( getDbHelp() = DatabaseHelper )

private void buildMainLayout() {
		setMainWindow(new Window("Demo application"));
		VerticalLayout layout = new VerticalLayout();
        layout.setSizeFull();
        
        TransactionList table = new TransactionList(this);
        table.setContainerDataSource(getDbHelp().getTransactionContainer());
        table.setImmediate(true);
        table.setSizeFull();
        
        VerticalLayout temp = new VerticalLayout();
        
        Embedded logo = createHeader();
        MenuBar menu = createMenu();
        temp.addStyleName("backgroundimage");
        temp.addComponent(logo);
        temp.addComponent(menu);
        temp.addComponent(table);
        
        verticalSplit.setFirstComponent(temp);
        layout.addComponent(verticalSplit);
        layout.setExpandRatio(verticalSplit, 1);

        getMainWindow().setContent(layout);

    }

DatabaseHelper

package com.example.vaadinsample.sql;

import java.sql.SQLException;

import com.vaadin.addon.sqlcontainer.SQLContainer;
import com.vaadin.addon.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.addon.sqlcontainer.connection.SimpleJDBCConnectionPool;
import com.vaadin.addon.sqlcontainer.query.TableQuery;

public class DatabaseHelper {
    private JDBCConnectionPool connectionPool = null;
    private SQLContainer transactionContainer = null;

    private void initContainers() {
        try {
            TableQuery q1 = new TableQuery("INT_TRANSACTIONS", connectionPool);
            q1.setVersionColumn("TRANS_GUID");
            this.transactionContainer =  new SQLContainer(q1);
            
            
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    
    public DatabaseHelper() {
  	  initConnectionPool();
    }

    private void initConnectionPool() {
      	try {
      		connectionPool = new SimpleJDBCConnectionPool(
              	"oracle.jdbc.driver.OracleDriver",
              	"jdbc:oracle:thin:@dbsrv1:1521/DEV", "xxx", "xxx", 2, 5);
          	initContainers();
      	} catch (SQLException e) {
        	  e.printStackTrace();
        }
    }

	public void setTransactionContainer(SQLContainer transactionContainer) {
		this.transactionContainer = transactionContainer;
	}

	public SQLContainer getTransactionContainer() {
		return transactionContainer;
	}
}

I hope some staff will answer this, otherwise I have to remove Vaadin from my framework comparison…
Can’t be that hard to connect a Table with a Database… in Other frameworks I say “table.loadXYZ” or sth. and its filling my grid with data… I have to create a xml file first, but that is way easier than this… so please? 11 views and no replies, this community isnt that chatty, huh? :open_mouth:

Oh and another hint:

Even if I try to get the addressbook example running, I get a nullpointerexception. I manually created the tables in my oracle database. (And for sure edited the database details)

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.NullPointerException
	com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:999)
	com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.NullPointerException
	addressbook.data.DatabaseHelper.fillContainers(DatabaseHelper.java:121)
	addressbook.data.DatabaseHelper.<init>(DatabaseHelper.java:49)
	addressbook.AddressBookApplication.<init>(AddressBookApplication.java:62)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	java.lang.reflect.Constructor.newInstance(Unknown Source)
	java.lang.Class.newInstance0(Unknown Source)
	java.lang.Class.newInstance(Unknown Source)
	com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82)
	com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:973)
	com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:801)
	com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.20 logs.

Hi Felix,

Could you please provide a little more information about your problem. The “Ids must exist in the Container or as a generated column , missing id: x” error occurs if you try to set the visible columns to include a column that does not exist in the container (in this case it’s not in the database). Depending on your DB engine and possible settings the column name might be case sensitive and always either uppercase or lowercase, so make sure you check this. Unfortunately I don’t know what Oracle defaults to.

If the case sensitivity is the problem, it actually resides in your TransactionList class, so I can’t say for sure.

Regarding the AddressBook example, I have been informed that there unfortunately are some errors in the textual version. The source code in SVN ought to work without throwing exceptions. I’ll try to get the text updated.

HTH,
/Jonatan

Felix, do you use JPA or Hibernate?

Casesensitivity didnt change a thing. My Table has about 40 columns, I added the ID of it as versioncolumn, as you can see, or do I have to add ALL of them? I guess not.
I could provid more code if you want to, what do you need to know?

As you can see in my DatabaseConnection with JPA.
I also get a connection, the onlpy problem is still the Message:

As mentioned: I get the connection, it also returns me the rownums via vaadin api if I ask for it! But I cant get the table build because of that Error.

Here is my TransactionList

package com.example.vaadinsample.ui;

import com.example.vaadinsample.VaadinSample;
import com.vaadin.ui.Table;

@SuppressWarnings("serial")
public class TransactionList extends Table {
    public TransactionList(VaadinSample app) {
        setSizeFull();
        setContainerDataSource(app.getDbHelp().getTransactionContainer());
// 		["TRANS_GUID","STATUS","CREATED_BY","CREATED_DATE","BO_SYSTEM","ATIS_FUNDSGROUP_ID","RULE_CREATED_BY","RULE_ID","ORDER_TYPE","FO_TRANSACTION_TYPE","BO_SEC_TYPE","ACCT_ID","IN_ACCT_ID","ACCT_NAME","IN_TRANSACTION_TYPE","FLAG_CANCEL","BO_TRANSACTION_TYPE","BO_DETAIL_TRANSACTION_TYPE","FK_PM_ORDER_ID","TRADE_REF","TRADE_ID","TRADE_ID_SEQ","FO_TRADE_ID","SYSTEM_INCOME_ID","SEQ_NUMBER","BLOCK_COUNTER","BROKER_ID","BROKER_NAME","EXEC_BROKER","BROKER_REASON","TRADER_COMMENT","TRADER_NAME","COUNTERPART_TRADER","CR_STATUS"]
        
        setVisibleColumns(new Object[] { "TRANS_GUID","STATUS","CREATED_BY","CREATED_DATE","BO_SYSTEM","ATIS_FUNDSGROUP_ID","RULE_CREATED_BY","RULE_ID","ORDER_TYPE","FO_TRANSACTION_TYPE","BO_SEC_TYPE","ACCT_ID","IN_ACCT_ID","ACCT_NAME","IN_TRANSACTION_TYPE","FLAG_CANCEL","BO_TRANSACTION_TYPE","BO_DETAIL_TRANSACTION_TYPE","FK_PM_ORDER_ID","TRADE_REF","TRADE_ID","TRADE_ID_SEQ","FO_TRADE_ID","SYSTEM_INCOME_ID","SEQ_NUMBER","BLOCK_COUNTER","BROKER_ID","BROKER_NAME","EXEC_BROKER","BROKER_REASON","TRADER_COMMENT","TRADER_NAME","COUNTERPART_TRADER","CR_STATUS" } );
        setColumnHeaders(new String[] { "TRANS_GUID","STATUS","CREATED_BY","CREATED_DATE","BO_SYSTEM","ATIS_FUNDSGROUP_ID","RULE_CREATED_BY","RULE_ID","ORDER_TYPE","FO_TRANSACTION_TYPE","BO_SEC_TYPE","ACCT_ID","IN_ACCT_ID","ACCT_NAME","IN_TRANSACTION_TYPE","FLAG_CANCEL","BO_TRANSACTION_TYPE","BO_DETAIL_TRANSACTION_TYPE","FK_PM_ORDER_ID","TRADE_REF","TRADE_ID","TRADE_ID_SEQ","FO_TRADE_ID","SYSTEM_INCOME_ID","SEQ_NUMBER","BLOCK_COUNTER","BROKER_ID","BROKER_NAME","EXEC_BROKER","BROKER_REASON","TRADER_COMMENT","TRADER_NAME","COUNTERPART_TRADER","CR_STATUS" } );

        setColumnCollapsingAllowed(true);
        setColumnReorderingAllowed(true);

        /*
         * Make table selectable, react immediatedly to user events, and pass
         * events to the controller (our main application)
         */
        setSelectable(true);
        setImmediate(true);
        /* We don't want to allow users to de-select a row */
        setNullSelectionAllowed(false);
    }
}

Kind regards and thx for the help! Hope to get this fixed up soon, because I really like vaadin! :slight_smile:

Any new hints? :slight_smile: Some time went past and help would be useful! :frowning:

Hello,

I am sorry, but this can’t be true!
I gave this two weeks now… spent now about

4 man days

and It seems to be impossible to get ANY demo working with database connection… or even connect it by myself…



The opposite for writing my own example and connect it with my database?
dHTMLx → 30 Minutes to get it run
zkoss → 20 Minutes to get it run
icefaces → 30 Minutes to get it run

Oh and no, I did not need any demo for those 3! :O)

So vaadin must be a joke, and is in no way competitive to any other framework!
I really made an effort to maybe use vaadin for the company I work for, but those (support and impossibility to get it work) criterias made vaadin popping out of the framework list, and the option for getting payed for support and an enterprise license!

Sorry.

Kind Regards

the problem is that your naming conventions are wrong in the Bean
i had the same problem and fixed it by rename the bean’s fields