BeanItemContainer cannot be resolved to a type​

I am completing the backend tutorial and have the following error

https://vaadin.com/docs/-/part/framework/tutorial.html#framework.tutorial.backend

BeanItemContainer cannot be resolved to a type​

grid.setContainerDataSource(new BeanItemContainer<>(Customer.class, customers)); Any suggestions greatly appreciated.

Video notes
[url=https://www.useloom.com/share/508e9dc120dc482aaa7415485b2c4c5c]
https://www.useloom.com/share/508e9dc120dc482aaa7415485b2c4c5c

package com.duelchem;
import java.util.List;
import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

/**
 * This UI is the application entry point. A UI may either represent a browser window 
 * (or tab) or some part of a html page where a Vaadin application is embedded.
 * <p>
 * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be 
 * overridden to add component to the user interface and initialize non-component functionality.
 */
@Theme("mytheme")
public class MyUI extends UI {
    
    private CustomerService service = CustomerService.getInstance();
    
    private Grid grid = new Grid();

    @Override
    protected void init(VaadinRequest vaadinRequest) {        
        VerticalLayout layout = new VerticalLayout();
        
        layout.addComponent(grid);
        
        updateList();
        
        layout.setMargin(true);
        layout.setSpacing(true);        
        setContent(layout);
    }
    
    public void updateList() {
        List<Customer> customers = service.findAll();
        grid.setContainerDataSource(new BeanItemContainer<>(Customer.class, customers));
    }

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

[/url]

If you are using Vaadin 8, there were recently major changes in the binding-area

easy: they don’t work :wink:

Thank you, yes, I did use Vaadin 8.

How can one discern between all the tutorials that conflict with version 8 ?

I love Vaadin, with what I have seen thus far.

Hi Nicklas,

My focus is to acquire an understanding of Vaadin. I have a two week trial for Vaadin Designer 8 and the same tutorial that uses Vaadin 7 is not compatible with Vaadin Designer 8. Please, can you share an updated tutorial link to your MAIN first tutorial:

" This video is built with Vaadin Framework 7. There are some small differences if you use the latest version."

Are the videos Vaadin 7 and the instructions for Vaadin 8 ?

Hi,

Yes, instructions are for Vaadin 8. Some of the videos are almost the same, but you cannot follow them exactly. Skip the videos at this point and focus on written tutorial. The updated video tutorials are under construction, hopefully at least most of them will be published soon.

cheers,
matti

Thank you, does this also apply to the post I just made regarding the error?

I think something was left out between step 6 and step 7, as the grid is not connecting to the edit fields on the form.

Thank you. I have started over again, and this time with Vaadin 8, hoping the written instructions are accurate for the MAIN BEGINNERS tutorial.

Thank you. Shall try to find the link for the Book of Vaadin right now. As I have been trying to complete, since yesterday:


https://vaadin.com/docs/-/part/framework/tutorial.html

Found it, PDF.


https://vaadin.com/download/book-of-vaadin/vaadin-8/pdf/book-of-vaadin-pocket.pdf?submissionGuid=e1abb05d-9206-4607-8fe5-15b9193a5280

You can just call the grid.setItems(myCollection) and then do grid.addColumn(Entity::getSomething)

The documentation (or the Book of Vaadin) is quite good so it should be pretty easy to get started even if you’re not using Designer…

Hi Matti, been watching a few of your videos.

Hope to finally be able to populate a Vaadin Grid with remote data today.