Sequence generation for Composite entity that starts from 1 for each

Is it possible generating a separate sequence in composite entities for each sequence of the master entity?
For example, I have two entities, order and orderLines. There is a field orderNumber in order entity and itemNumber field in orderLines entity. for each orderNumber, the itemNumber field will start from 1 in the entity orderLines. Possible in CUBA?

I would suggest numbering of detail entities using simple iteration through existing items, as for example in this topic: https://www.cuba-platform.com/discuss/t/numberline-for-invoicedetails

Thank you, it worked well.