More removed functionality: UniqueNumbersService

It seems UniqueNumbersService was removed in Jmix, with no mention in the migration docs.

Any advice on how to replace its functionality? We have a lot of uses of it.

Use UniqueNumbersAPI in migrated projects or io.jmix.data.Sequences in new Jmix projects.

Regards,
Konstantin

I’ll check that out. Consider adding this to the migration docs? :slight_smile:

1 Like

Not sure. UniqueNumbersAPI is a well known CUBA interface, and now in Jmix it has a Javadoc saying what to use instead. We cannot explain all possible use cases and replacements anyway.

But UniqueNumbersService simply doesn’t exist in Jmix and prevents compile obviously… And there’s no pointer as to what to replace it with.

That’s true. Still, this migration is not very smooth. I shudder to think what people with larger, finished apps, will go through.

Also, most of my uses are in entity classes where in CUBA, injection wasn’t possible and AppBeans.get() was used. This seems to be gone in Jmix, so… advice on how to get access to UniqueNumbersAPI in an entity class?

You can create your own AppBeans class in your project, see this topic: Is there any alternatives to AppBeans

5 posts were split to a new topic: Using sequences

Is UniqueNumbersAPI avaliable in version 2 JMIX?

Hi,

The corresponding equivalent is probably Sequence Generation :: Jmix Documentation

Cheers
Mario

1 Like

Thank you Mario

Hi,
Also was necessary to found a solution for this when I start to rewrite code to switch from Cuba to Jmix.

Look at my code (method onPreSave)

In my code I used two separated sequences numbers for two Institution.
I used solution from Documentation, link posted by Mario.