Exception when sorting one to many relation

Hello,
the proben can be reproduced using the attached project.

I have two entites: Customer ans Order. One Customer has many orders.

Customer.java


@Table(name = "SORTDEMO_CUSTOMER")
@Entity(name = "sortdemo$Customer")
public class Customer extends StandardEntity {
    private static final long serialVersionUID = 5651503276941310295L;

    @Column(name = "NAME")
    protected String name;

    @Composition
    @OnDelete(DeletePolicy.CASCADE)
    @OneToMany(mappedBy = "customer")
    protected Set<Order> orders;

...
    
	@Transient
    @MetaProperty(related = "orders")
    public String getOrderList() {
        return orders.toString(); // simplified to String implementation
    }
}

In customer-browse.xml two columns ‘name’ and ‘orderList’ are displayed.

The problem can be produced with this workflow:

  1. Login to applicaton
  2. Open Applicaton/Customers
    -> the list of customers with one entry is displayed
  3. Click on orderList column to sort it
  4. Click search to reload the data
    -> A NullPointerException occures
  5. Logout & Login again
  6. Open Applicaton/Customers
    -> Internal error happens (also NullPointerException)

You have to delete the UserSetting for ‘sortdemo$Customer.browse’ to open the Customers list again.

I have to admit that sorting a one to many relation will not create a meaningful result. But this bug creates a situation where the user cannot user a certain grid anymore.

Thanks in advance.

Yours,
Joerg

sort-demo.zip (129.5K)

Hi Joerg,

Thank you for reporting the issue and for the test project.

The issue is fixed for the platform versions 6.3.6 and 6.4.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8441