Is it possible to create a View to see the sys_sequence table in Cuba-Plaform and to maintain the sequences?
The SYS_SEQUENCES table is used for UniqueNumbers only in case of MySQL. For other databases the implementation is different.
Probably you can create a UI for this table, but why do you need this? There are database-independent methods in the app-core.cuba:type=UniqueNumbers JMX bean, which is available via Administration > JMX Console.
That is correct. But how can I change the sequence if I need to do some modifications of sequence.
Normally it is not necessary but sometimes I have to do some modifications.
I did see that I can change it in the sys_sequence table.
Is this recommended?
I do use:
@Inject
private UniqueNumbersAPI uniqueNumbers;
private long getNextValue() {
return uniqueNumbers.getNextNumber("mySequence");
}
When I generate a number from UniqueNumbersAPI the sequence is created in the sys_sequence table.
But how can I access this table via Cuba-platform. Any Ideas?
You can create a non-persistent entity, load data from table to the list of these entities and work with them on UI using a custom datasource. Take a look at this sample application: GitHub - aleksey-stukalov/custom-datasource: This example illustrates how to create and use custom collection datasource in the CUBA Platform
-
Foo - a non-persistent entity
-
FooServiceBean - a service loading data from a table into a list of Foo
-
FooCollectionDatasource - a custom datasource for Foo
-
foo-screen.xml - a screen displaying the list of Foo