Why should I use SQLContainer over a standard SQL Connection?

I’m totally new to vaadin, and just tring to figure out if I should be connecting to my database using SQLContainer or java.sql.Connection like I’m used to doing? (Maybe I’m missing some key concepts here…)



I think you’ve gotten this a bit wrong. The SQLContainer is merely a helper to get data from your database into Vaadin Container format which you can then simply use in e.g. the Table component. In fact, if you use the SimpleJDBCConnectionPool for the actual connection it uses java.sql.Connection instances anyway.

In the end, the choice is yours. One option is to use SQLContainer which could make things a lot easier for you, handling mapping the database rows to container items and even updates, filtering and sorting. On the other hand, if you have any kind of special case you might find a hand-written implementation easier to customize.

Thanks for taking the time to reply!

It’s clear now what to do. I’ll use SQLContaining when I can, however I use a lot of stored procedures so I’ll just use my standard methods for that.