Weird FTS issue

Hi,
now I have merged my recent developments to master and tried to deploy it, strangely enough loads of error messages are coming up on core module such as


Caused by: org.eclipse.persistence.exceptions.DatabaseException:
19:46:58
Internal Exception: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of com.haulmont.cuba.core.sys.persistence.PostgresUUID. Use setObject() with an explicit Types value to specify the type to use.
19:46:58
Error Code: 0
19:46:58
Call: delete from SYS_FTS_QUEUE where ID in (?, ?)
19:46:58
bind => [6b05bed4-3245-b357-e25e-dcf41dddafbe, 64cad08b-19cb-ada0-a353-e74401d6df76]
19:46:58
Query: DataModifyQuery(sql="delete from SYS_FTS_QUEUE where ID in (?, ?)")
19:46:58
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) ~[eclipselink-2.6.2.cuba11.jar:2.6.2.cuba11]
19:46:58
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:684) ~[eclipselink-2.6.2.cuba11.jar:2.6.2.cuba11]

In the mentioned table (SYS_FTS_QUEUE) there is exactly those two records, which id’s are in the log. So I think it tries to delete them, but fails somehow. If I delete those two records, the error messages stop.
Could you please help me in this, how could I track it down?

Thanks
Gabor

As I see, the error happens in com.haulmont.fts.core.app.FtsManager.java in removeQueuedItems:


protected void removeQueuedItems(List<FtsQueue> list) {
        try (Transaction tx = persistence.createTransaction()) {
            EntityManager em = persistence.getEntityManager();

            for (int i = 0; i < list.size(); i += DEL_CHUNK) {
                StringBuilder sb = new StringBuilder("delete from SYS_FTS_QUEUE where ID in (");
                List<FtsQueue> sublist = list.subList(i, Math.min(i + DEL_CHUNK, list.size()));
                for (int idx = 0; idx < sublist.size(); idx++) {
                    sb.append("?");
                    if (idx < sublist.size() - 1)
                        sb.append(", ");
                }
                sb.append(")");

                DbTypeConverter converter = persistence.getDbTypeConverter();

                Query query = em.createNativeQuery(sb.toString());
                for (int idx = 0; idx < sublist.size(); idx++) {
                    query.setParameter(idx + 1, converter.getSqlObject(sublist.get(idx).getId()));
                }
                query.executeUpdate();
            }

            tx.commit();
        }
    }

converter.getSqlObject(sublist.get(idx).getId()) is a PostgresUUID
and for some reason postgres doesn’t like this… But what I don’t understand, that how could this work perfectly without my changes? :frowning: (I mean the original code in master is at version 6.3.6 as well) I clearly haven’t modified cuba code…

Gabor

I think I’ve found it: in the build.gradle at task buildWar there was a property injected, called “includeJdbcDriver” and was set to true. I don’t remember me doing this, I think it must have been done by some script, either when I’d enabled web-toolkit, or with some update - I really don’t know.
According to the documentation, this will "include JDBC driver which is currently used in the project. false by default."
Obviously in my case it’s outdated, or there is something wrong with it. I don’t remember downloading any kind of jdbc driver.
Where is this driver coming from, if I enable the switch?

Thanks
Gabor

Hi Gabor,

If this option is set, the task copies all dependencies specified in the jdbc configuration of your core module in build.gradle.

Hi Konstantin,
thanks, I see. at the moment there is a line jdbc(postgres) there…