? equals = myPojoProviderService.getAllMyPojos()

A basic stupid question, please advise:

myPojoProviderService.getAllMyPojos = ?


video notes

Grid grid = new Grid<>();

The DAO bean I have is named sqlDAO.java

I do not know what:
??? = MyPojo
??? = myPojoProviderService.getAllMyPojos

Because this is a question about another forum user’s sample code, it really should go on the original thread so that the original user can clarify his code.

In any case, the MyPojo class, the provider service, and the method are all completely made up to demonstrate that you can use Java generics with an arbitrary provider of an arbitrary generic type. Before Vaadin 8, you had to take your collection of items, configure and populate a container (e.g. BeanItemContainer), and then attach it to the component (e.g. Grid), sacrificing type safety along the way.

– AC

Thank you Alejandro.

I did not continue with the original thread, as the question is something very basic, that would take someone that knows a few seconds to answer, but someone that does not know – a lot of trial and error and searching.

All I am seeking is what is the EQUAL value of


my DAO bean is sqlDAO.java

would the same be represented as


What is getAllMyPojos represent ?

So close and yet so far away…

Please, there must be a REAL value for the generic example of


I only have two beans:

  1. A Vaadin 8 Archetype called MainUI.java as seen in the screenshot
  2. sqlDAO.java which connects to remote MySql data


Can you post the code for sqlDAO.java?

Thank you!


package com.basic.basicapp;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class sqlDAO

public static void main(String args) throws Exception
//access driver from jar
//create variable for connection “con”
Connection con = DriverManager.getConnection(“jdbc:mysql://***************-west-2.rds.amazonaws.com:3306/webdata”, “username”, “password”);
PreparedStatement statement = con.prepareStatement(“select * from product”);
//create query variable
ResultSet result = statement.executeQuery();
System.out.println(result.getString(1) + " " + result.getString(2) + " " + result.getString(3));

The variable is


which holds the data

Thanks for the code. First thought is that this class is not a bean, nor really a DAO. This class needs a method that returns a collection of objects that have the data that you need. So, I recommend that you create an actual bean type that represents a single row in your product table, and will represent a single grid row. Note that I can’t tell from your code what the actual column names are since you are using
select *

public class Product {
    private final String field1;
    private final String field2;
    private final String field3;

    public Product(String field1, String field2, String field3) {
        this.field1 = field1;
        this.field2 = field2;
        this.field3 = field3;

    public String getField1() { return field1; }
    public String getField2() { return field2; }
    public String getField3() { return field3; }

Next step, add a method to your DAO class that performs the database query and populates a Collection class, e.g. ArrayList().

public class SqlDAO {
    public List<Product> getAllProducts() {
        // ... your DB code here

        // Populate a list of products
        List<Product> products = new ArrayList<>();
        while(result.next() {
            products.add(new Product(result.getString(1), result.getString(2), result.getString(3)));
        return products;

Finally, call this method and pass the results to the
method on your

Thank you, shall create the Model and the DAO, then create a Vaadin Archetype to run setItems().

Thank you.

Alejandro – have reinstalled my system and just now creating a new Vaadin 8 Archetype I have my back end JSF beans:

  1. MODEL
  3. DAO

the data connectivity is within the context.xml and the web.xml

Am installing Vaadin for Eclipse right now, then shall – again, try to connect the remote sql data to a Vaadin Grid.

Shall post here within the next 30 minutes, with a hope that you may have a moment to view.

Thank you.

Hi Alejandro C De Baca,

In a Vaadin 8 Archetype that I just created, I have placed my JSF java source files in the Project but do not know how to place the connection data. In the JSF, the connection data is in the context.xml (Resource) and web.xml (username, etc…)

The connection data is in the Project but is not being found.

Video notes


I have the two Projects next to each other in Eclipse. The JSF web app runs with plain html table. The Vaadin 8 Archetype runs as well.

I can copy my Model, Controller and DAO files from the JSF to the Vaadin Archetype, but the data connection is within the context.xml and web.xml

How do I modify my Vaadin Archetype to access my remote data?


I’m not sure what isn’t working, but I can give you a few pointers to get you started.

If you have m2e and m2e-wtp installed in Eclipse, then you can add the Dynamic Web Module facet to your Vaadin archetype project (right click your project, select Properties, choose Project Facets from the left pane). If your project is not already in faceted form, converting it and adding Dynamic Web Module will give you a WebContent folder with a WEB-INF and a META-INF, so you now have a destination for your web.xml and context.xml.

Your deployment assembly (also under project properties) must include the following mappings:

/WebContent => /
/src/main/webapp => /
Maven Dependencies => WEB-INF/lib

I’ve attached an image that shows you the mappings I have for one of my projects that deploys to a server (instead of using the jetty-maven plugin). Note the options in the “New Assembly Directive” dialog box. If you don’t see these options (e.g. Java Build Path Entries), then make sure m2e and m2e-wtp are installed correctly.

Finally, I recommend making your mysql jdbc connector 5.1.40 a maven dependency instead of a referenced library. You can do that by adding the following lines to your pom.xml in the section:

<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.40</version> </dependency> I matched the version you are using in the video; there are
more recent releases
than 5.1.40.

Best of luck.

– AC


You are the BEST!

Shall make the change for the mysql jar right now.

choose Project Facets from the left pane). If your project is not already in faceted form, converting it and adding Dynamic Web Module will give you a WebContent folder with a WEB-INF and a META-INF, so you now have a destination for your web.xml and context.xml.

It is already selected but there is NO Web Content folder created. I had copied the Web Content folder from the JSF Project and Pasted it into the Vaadin 8 Archetype Project


Does that image show the facets for your Vaadin archetype project? I don’t think JSF should be selected, just Dynamic Web Module and Java. Regardless, what matter most are the deployment assembly mappings.

OK, it worked… the data displays!

You are the GREATEST!

Just need to now display same data in a Vaadin Grid

video notes