Problem displaying data to grid Vaadin 24

Hi, usually i dont have any problem inserting data to Grid, but i got very unique problem that i can’t fix for days.

Why my grid data like this (the row apply all data with the last data column, in my case. like Attachment 1, All row filled with the ‘Balance Available’ data.)?
i tried to reconfigure my grid, and set each column with key. and i got the same result. (if you told me that the data is the problem, its not correct, because i tested it and it return correct data.)

What i do is creating Dialog, and i add Grid to Dialog, i got no problem with different grid.

below is my fullcode for the Dialog below (Attachment 2).

Thank you so much.

EDIT : I tried it with the base entity layout on the grid, it works perfectly. but the placement of each column is not right. so i need to re-position it

if you wonder the Entity.

@Table(name = "payadv_balance")
public class PayadvBalance extends AbstractEntityUUID {

    private double balanceMaxAmount;

    private double balanceUsedAmount;

    private LocalDate balanceFirstPeriod;

    private LocalDate balanceLastPeriod;

    private double currentAvailableBalance;

    private String tpCustomerId;

    @Column(name = "paid_Status")
    private boolean isPaid;


Only thing that comes to mind would be equals or hash code problems - your object is an entity and therefore lombok’s data annotation can cause some interesting problems

And remove your invisible id column

Also remove the IDs und Keys If you don’t need them. If you don’t use preconfigured columns, it’s also unnecessary to pass Bla.class to the grid’s constructor. So that no columns are created and removed from you again. Additionally I can only see a Component annotation, which in case makes this component a singleton which is impossible

NEVER use @Data with JPA. Equals and hashCode are wrong and can lead to stack overflows

thanks for replying!. i tried to remove @Data annotation, and remove all the unnecessary keys but it still return the same.

im using @Data to other entities and added it to other grid it works perfectly.

and yes. this is Component. and it getting called from the main layout with the Entity data.

below is the result if i dont use any addColumn .

and this is my JPA Query

    @Query("select b from PayadvBalance b where b.tpCustomerId = :tpUserId order by b.createdDate desc ")
    List<PayadvBalance> findAllByTpCustomerIdOrderByCreatedDateDesc(@Param("tpUserId") String tpUserId);


Maybe you have that Data in your entity superclass as well?

That Data annotation (and more specifically default equals/hashCode generation in Lombob) should indeed be killed with :fire:. It is only legid for immutable classes.

Been just today working on an article explaining why.

An Gist made earlier today related to my unfinished article: A code snippet that helps to explain why you should not use @Data annotation or override equals/hashCode without further thinking. · GitHub

And my work in progress JDK PR related to the same issue cluster: Improved the JavaDocs of the equals method by mstahv · Pull Request #16823 · openjdk/jdk · GitHub

thanks for reply!.

“Maybe you have that Data in your entity superclass as well?” No, im using auto generate column and uuid. this is my “AbstractEntityUUID”

public class AbstractEntityUUID {

    @GeneratedValue(strategy = GenerationType.UUID)
    private UUID id;

    private int version;

    private String createdBy;
    private LocalDateTime createdDate;
    private String updatedBy;
    private LocalDateTime updatedDate;

    //getter setter...

and yeah. im so sorry because english is not my first language so i dont think i understand the article. but i made it simple.

so what i do is remove the unused column and this is the result (below). and maybe i just need to render the result. is there any way to render the data without addColumn? (im using getColumnByKey but it return this error

Cannot invoke "com.vaadin.flow.component.grid.Grid$Column.setRenderer(" because the return value of "com.vaadin.flow.component.grid.Grid.getColumnByKey(String)" is null

You should post a bit longer stacktrace so we could help.

im sorry, this is the full stacktrace
stacktrace-error.txt (15.4 KB)

anyway. @JsonProperty is not changing the key right? because i use this entity for microservice

i try to add the renderGrid() to the setBalanceDetail() so it’ll be trigger when component is open. i know this is stupid but i give it a shot

You server and code is not in sync. You don’t have this line (at least in your snippet you sent)

In the screenshot it is there.

You are referencing to your columns with “key” and there is no such column, that is what the error is about.