Vaadin + JDBC

Hello there,

I am currently having difficulites with embedding my Java code (incl. MySQL database connection) in the Vaadin framework.
I was wondering if there is any way to use Vaadin solely with the simple JDBC API or if it is only possible with JPA, Hibernate, etc.? I only have a couple of tables with small content (233 rows, 8500 columns) and I am the only developer on this small project (Bachelor thesis).
Therefore I thought that JDBC would fit my needs just fine, but I cannot find any helpful resources on how to connect my Code with Vaadin neatly in order to write a small web interface for user interaction.

I would be so very greatful to hear from you, as no one at my working group has had experciance with Vaadin and I am worried that I might have to re-write my entire code!

Sincerely, Marie

JDBC is actually more of a standard way to access a DB in Vaadin than JPA and Hibernate is.
Just create a JDBCConnectionPool and then use TableQuery or FreeformQueries in addition with SQLContainers to access your table(s). For examples on how to it just have a look at the Book of Vaadin.

public class Pool implements Serializable {

/**

 * 

 */ 

//TODO implementar un Pool adeacuado para volumen

private static final long serialVersionUID = 1L;

JDBCConnectionPool pool;

    



public Pool(String Driver,String url,String user,String password) throws SQLException {

    pool = new SimpleJDBCConnectionPool(Driver, url,

            user, password, 2, 5);    

    

}



public JDBCConnectionPool getPool() {

    return pool;

}

}

and then in other class

public SQLExtContainer getTabla(String NombreTabla,String llave,Boolean autoCommit) throws Exception{

    TableQuery tq= new TableQuery(NombreTabla, pool.getPool());

    tq.setVersionColumn(llave);

    SQLExtContainer sql = new SQLExtContainer(tq);

    sql.setAutoCommit(autoCommit);

    return  sql;

}

Thank you so much for the input!
I will give it a try for sure and let you know how that went! :wink: