Daniel Paczuski Bak
Daniel Paczuski Bak

Reputation: 4088

Vaadin: What is the point of a H2 database?

The JPAcontainer tutorial here: https://vaadin.com/download/jpacontainer-tutorial/

Indicates that you need a H2 database driver with JPAcontainer. I don't understand why? - what functionality do you loose from not having H2 as well as JPAcontainer?

Upvotes: 1

Views: 919

Answers (1)

Steffen Harbich
Steffen Harbich

Reputation: 2759

For the record:

  • H2 is a database that is slim and can be run as server or embedded in your Java application (in-memory). It provides a JDBC driver.
  • JPA is a Java API that provides an interface for object relational mapping (ORM). Implementations, e.g.:
    • Hibernate
    • EclipseLink

Vaadin's JPAContainer is independent from the database and JPA implementation you deploy. It is built upon JPA to implement the Vaadin Container interface. It is somewhat similar to the SQLContainer but uses JPA instead of plain SQLs.

However, you need a database and its JDBC driver to make use of the JPAContainer. Your linked tutorial takes H2 for that, probably because H2 is open source, free and simple.

That said, you can safely replace H2 with your favorite database.

Upvotes: 5

Related Questions