Business Logic with JPA/Hibernate

From a UI building rapid productivity I’m pretty sold on Vaadin. The documentation is really good, the components look great, and I feel I can build something pretty quick, even though I’ve spent not a lot of time with Vaadin.

However, the missing puzzle piece for me at the moment is where to place business logic especially in conjunction with using the persistent container aspect of Vaadin. For example, if I show a record, and then allow the user to update it, where would I put the logic to validate whether that user should be able to update the record back on the server-side, obviously the client should not allow this, but it also seems the server needs to enforce it.

Another case would be for workflow, the user shouldn’t be able to change the state to certain other states, etc, or it needs to send an email, etc. It looks like the logic gets kind of buried in the container. I imagine there is a “best practice” around this, I just really haven’t found many examples surrounding the container persistence it seems, at least in regard to business logic.

So the short question is:
Using a persistent container, where should business logic go? (ie. on hibernate beans, or ?, what’s best practice?)


Vaadin Framework does not set, recommend or even lean towards some particular architectural approach. It is just a UI layer. Even though this freedom makes it applicable to wide variety of applications, it also raises questions on architecture selection and best practices.

In many cases, it is best to go with architecture well suited for the the stack and what developers are familiar with.

As a personal preference, I like a
lean architecture with minimal number of layers as defined by Spring Roo
. For that you can also use Spring Roo with Vaadin.

is a “logic engine” that plugs into Hibernate, and executes declarative (spreadsheet-like) logic you supply in “companion classes” that correspond to your POJOs. This encapsulates your business logic, while leaving Hibernate interfaces and POJO objects unchanged. It has been verified to work with Vaadin.