Vaadin 7.4.6 + Glassfish 4.1 + JavaEE 7 + JPAContainer

I’m starting to test this framework and I can’t get data from my JPA Entities into a Table or even print the elements onto the console.

I get this error on Glassfish log.

Grave: java.lang.IllegalArgumentException: No [EntityType]
was found for the key class [com.felixovelar.notificadorcumpleanhos.entities.Empleados]
in the Metamodel - please verify that the [Entity]
class was referenced in persistence.xml using a specific com.felixovelar.notificadorcumpleanhos.entities.Empleados property or a global false element.

This is my persistence.xml

<?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider jdbc/CumplePool false

This is my code:

public class EmpleadosUI extends UI {

protected void init(VaadinRequest request) {

    VerticalLayout content = new VerticalLayout();

    content.addComponent(new Label("Empleados"));

    HorizontalLayout horizontalLayout = new HorizontalLayout();

    EntityManager em = JPAContainerFactory.createEntityManagerForPersistenceUnit("com.felixovelar_NotificadorCumpleanhos_v5_war_1.0PU");
    if (em != null) {
        System.out.println("******* NO ES NULL!!!");
        if (em.isOpen()) {
            System.out.println("******* esta abierto el EM");
            JPAContainer<Empleados> empleados = JPAContainerFactory.make(Empleados.class, em);
            System.out.println("*****+++++ Elementos en Contenedor="+empleados.size());
            Table tabla = new Table("Lista de Empleados", empleados);
            horizontalLayout.setExpandRatio(tabla, 1);
    } else {
        System.err.println("******* Es null :(");
    System.out.println("****** fin");

    content.setExpandRatio(horizontalLayout, 1);

@WebServlet(urlPatterns = "/*", name = "EmpleadosUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = EmpleadosUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {


If I instead of using Table try to print the elements whith this code:

EntityManager em = JPAContainerFactory.createEntityManagerForPersistenceUnit(“com.felixovelar_NotificadorCumpleanhos_v5_war_1.0PU”);
if (em != null) {
System.out.println(“******* NO ES NULL!!!”);
if (em.isOpen()) {
System.out.println(“******* esta abierto el EM”);
List listaEmpleados = (List)em.createNamedQuery(“Empleados.findAll”, Empleados.class).getResultList();
System.out.println(“====******==== CantidadEmpleados=”+listaEmpleados.size());
for (Empleados empleado : listaEmpleados) {
System.out.println("======+++++++ Empleado: " + empleado);

    } else {
        System.err.println("******* Es null :(");

I get this error in the logs:
It’s an error trying to cast Empleados (Employee Entity) to Empleados!!

Información: ******* NO ES NULL!!!
Información: ******* esta abierto el EM
Grave: java.lang.ClassCastException: com.felixovelar.notificadorcumpleanhos.entities.Empleados cannot be cast to com.felixovelar.notificadorcumpleanhos.entities.Empleados
at com.felixovelar.notificadorcumpleanhos.EmpleadosUI.init(
at com.vaadin.ui.UI.doInit(

… a very long stack trace…

Información: ====******==== CantidadEmpleados=9
(It prints the Size of the List. So I assume the data it’s there.)

I don’t know what I’m doing wrong. Maybe just missing something.

Will appreciate any help from you guys.



My pro tip is to keep away of JPAContainer. I really no more find a real case where it would be the perfect choice. Sorry this comes one week late, it has been super busy week for me.

Instead of JPAContainer you can just fetch the list of entities from your backend and list them in components for example with BeanItemContainer. Or if you face memory/performance issues with really big tables you could look at ListContainer in
or its “lazy loading” extensions (see e.g.
this example