Updating entities with composite primary key in a datagrid


I have an entity with composite primary key as shown below.

@Table(name = "Books")
@Entity(name = "test_Books")
public class Books extends BaseGenericIdEntity<BooksCompKey> {
    private static final long serialVersionUID = -3697932020375183350L;
    protected BooksCompKey id;   
    @Column(name = "Category", length = 50)
    protected String category;
    public void setId(BooksCompKey id) {
        this.id = id;
    public BooksCompKey getId() {
        return id;
    public String getCategory() {
        return category;

    public void setCategory(String category){
        this.category = category;
@MetaClass(name = "test_BooksCompKey")
public class BooksCompKey extends EmbeddableEntity {
    private static final long serialVersionUID = -9160494969168442626L;
    @Column(name = "BookName", nullable = false, length = 128)
    protected String bookName;
    @Column(name = "AuthorId", nullable = false)
    protected Integer authorID;

    public int hashCode() {
        return Objects.hash(authorID, bookName);

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BooksCompKey entity = (BooksCompKey) o;
        return Objects.equals(this.authorID, entity.authorID) &&
                Objects.equals(this.bookName, entity.bookName);

    public Integer getAuthorID() {
        return authorID;

    public void setAuthorID(Integer authorID) {
        this.authorID = authorID;

    public String getBookName() {
        return bookName;

    public void setBookName(String bookName) {
        this.bookName = bookName;

I want to display this entity in a datagrid and edit the values in the grid.

<collection id="booksDc" class="com.test.entity.Books" view="_local">
            <loader id="booksDl"/>
 <dataGrid id="booksGrid" dataContainer="booksDc" editorEnabled="true">                        
                        <column id="category" property="category" caption="Category"/>
                        <column id="id.bookName" property="id.bookName" caption="BookName"/>
                        <column id="id.authorID" property="id.authorID" caption="AuthorID"/>

When i edit the values in the grid , I get the below exception
IllegalArgumentException: Can’t find getter for property ‘id.bookName’ at class com.test.entity.Books.

Could you please help to fix this issue?

Thank you for reporting the problem. We have created the issue: Cannot edit entity in DataGrid when related or embedded entity properties are presented · Issue #2648 · cuba-platform/cuba · GitHub
The exception occurs in crossFieldValidation logic. Probably, you can turn it off in DataGrid settings.