Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Complete Newbie With Database Questions

Ross Peoples
1 decade ago Apr 08, 2010 2:10am
Kim Leppänen
1 decade ago Apr 08, 2010 5:17am

You have a number of options. The most popular choices are probably either using JDBC directly, which means you'll write your queries yourself, populate your objects manually - well, basically do everything manually. Another option is to use JPA which is highly popular in the java world. JPA is a standard which defines how object relations should be marked and how the objects should be stored and managed in databases.

The advantage with JPA is that it abstracts away the database layer.You'll be using an O/RM, which means that you don't have to care about populating objects manually and keeping track of changes in objects etc. With JPA you can do lots of things quite quickly. Everything comes with a price, in this case the price is that you won't have as much control of what happens in the database layer and optimising JPA in a complex enterprise size application can be hard.

If you decide to use JPA, I recommend that you take a look at a small framework called Application Foundation I've written. One of the things I've wanted to achieve with it is to make JPA based persistence easier for Vaadin developers. JPA isn't exactly meant for statefull applications like Vaadin, so there are a few gotchas you'll need to know. The Application Foundation contains a persistence module which provides a JPA based persistence to the developer, hiding all the gotchas mentioned. If you are interested, you can get the Application Foundation from the directory. Make sure you'll read the the documentation of the persistence module, just to get you started and to see how it is used.