Classes related to database support extends according to following template <dbmsType><dbmsVersion><InterfaceName>.
So you have to create Postgres<dbmsVersion>SequenceSupport class where <dbmsVersion> is some string constant. After that set the cuba.dbmsVersion property value to <dbmsVersion>.
If it becomes necessary to debug check com.haulmont.cuba.core.sys.persistence.DbmsSpecificFactory#create(java.lang.Class<T>, java.lang.String, java.lang.String) method.
In order to use MAXVALUE of Postgres sequence, I would need to extend the class Sequence of Cuba to include th MAXVALUE. However the class is not extendable because of private constructor.
It looks like I need to implement various classes in order to be able to use the features of Postgres sequences. Do you know a better efficient approach to do it?
Hi,
You can implement your own Spring bean and service if you need custom logic.
Why do you need to override the logic of SequenceSupport from the platform?
Basically I want to override the method createSequenceSql of the PostgresSequenceSupport class to be able to use full functionality of Postgres sequence (PostgreSQL: Documentation: 13: CREATE SEQUENCE).
The idea is to be able to define minvalue, maxvalue as well as the cycle.
Is there any reason that you need to override the platform logic instead of creating your own Spring bean alongside existing UniqueNumbersService functionality?
I thought even with my Spring Bean I would need to implement the same logic as the platform. I thought it would be simpler to extend the platform implementation.
So if I understand well you are suggesting to create a new CustomUniqueNumbersService that defines a method such getNextNumber(String seqName, long min, long max, long incr, bool cycle) and then I have to implement the SQL statements in the CustomUniqueNumbersServiceBean?