Ambiguous getter for Field… Room persistence library

前端 未结 6 1735
野性不改
野性不改 2021-01-14 00:11

I have the following Entity

public class User {
    @PrimaryKey
    private final long id;

    private String _id;
    private String userName;
    private          


        
6条回答
  •  醉梦人生
    2021-01-14 00:58

    For Room :

    In my case

    public String getpBSalesTotal() {
        return pBSalesTotal;
    }
    
    public void setpBSalesTotal(String pBSalesTotal) {
        this.pBSalesTotal = pBSalesTotal;
    }
    

    is the previous POJO class that i want as a table in my database.

    I have just changed small "" p "" to capital ""P"" and that solved my error

    . Like below

    public String getPBSalesTotal() {
        return pBSalesTotal;
    }
    
    public void setPBSalesTotal(String pBSalesTotal) {
        this.pBSalesTotal = pBSalesTotal;
    }
    

    to generate this type of

    POJO form JSON

    you can use this LINK. It worked for Room.

提交回复
热议问题