| I also stumbled upon this scenario which seemed not to work with null values:
public class StringListEntity {
@Id
@GeneratedValue
private Integer id;
@ElementCollection
@OrderColumn
private List<String> values;
}
@Test
public void testElementCollectionIndexedList() {
doInJPA( this::entityManagerFactory, entityManager -> {
final StringListEntity entity = new StringListEntity();
entity.getValues().add( null );
entity.getValues().add( "someValue" );
entityManager.persist( entity );
} );
}
In this use case, when the collection is persisted by ORM only the someValue element gets persisted; however when the list is hydrated from the database it will be [ null, "someValue" ] because of the indexing. Unfortunately Envers did not seem to adhere and work with such a use case. So I plan to mimic the behavior from PersistentList#readFrom where we expand the list in-flight as the results as added to guarantee space for the indexed use case. |