Bug with dataGrid aggregation and identity columns

I believe there is a bug when using aggregation on dataGrids. I’m using Jmix 2.2.1 and studio 2.2.2-241.

I have two entities, Order and OrderLineItem, with a one-to-many relationship. Each entity uses an Integer identity column.

The Order detail view contains a dataGrid of OrderLineItems. The create/edit/remove actions behave as expected when no aggregation is used. However, if aggregatable is enabled and I attempt to sum a column, I can no longer create new entities. I receive an error message: IllegalArgumentException: entity or id is null.

If I use a Jmix generated Integer id using @JmixGeneratedValue rather than @GeneratedValue(strategy = GenerationType.IDENTITY), I’m able to use aggregation and create new line items from the order detail view.

Aggregation with tables worked properly with Jmix 1.5.5 using Integer identity columns. Below are the first few lines of the stack trace. I’ve posted a sample project on GitHub.

java.lang.IllegalArgumentException: entity or id is null
	at io.jmix.core.common.util.Preconditions.checkNotNullArgument(Preconditions.java:101)
	at io.jmix.flowui.model.impl.CollectionContainerImpl.getItemIndex(CollectionContainerImpl.java:123)
	at io.jmix.flowui.model.impl.CollectionContainerImpl.getItemOrNull(CollectionContainerImpl.java:117)
	at io.jmix.flowui.model.impl.CollectionContainerImpl.getItem(CollectionContainerImpl.java:108)
	at io.jmix.flowui.data.grid.ContainerDataGridItems.getItemValue(ContainerDataGridItems.java:208)
	at io.jmix.flowui.data.aggregation.impl.AggregatableDelegate.lambda$valuesByProperty$0(AggregatableDelegate.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)