Cuba Data store with Oracle 8i

Hi,
there is a way to configure eclipselink for query generation without “left outer join” syntax?
I have a old Oracle 8i database as secondary datastore. As a eclipselink docs, I’m trying to configure my persistence file (generated by Cuba studio) by setting eclipselink.target-database property, but this specification not have effects.

Any suggestions?
Thanks!

Hi,

The value from OracleDbmsFeatures has a priority over what you define in persistence.xml. So you probably need to introduce your own DBMS Version and create appropriate Oracle8DbmsFeatures class where you will be able to define eclipselink.target-database and possibly other parameters.

Thanks Konstantin! Now my application work fine!

Would be great if you provide here your set of classes for supporting Oracle8. It may help other developers!

Sure!
First of all, as you suggest (and the manual too) in your first reply, I created a Oracle8DbmsFeatures:

public class Oracle8DbmsFeatures implements DbmsFeatures {

    private static final Logger log = LoggerFactory.getLogger(Oracle8DbmsFeatures.class);

    @Override
    public Map<String, String> getJpaParameters() {
        Map<String, String> params = new HashMap<>();
        params.put(PersistenceUnitProperties.TARGET_DATABASE, "com.haulmont.cuba.core.sys.persistence.CubaLsOraclePlatform");
        params.put(PersistenceUnitProperties.NATIVE_SQL, "true");
        return params;
    }

public class Oracle8DbTypeConverter implements DbTypeConverter {
...
}
public class Oracle8SequenceSupport implements SequenceSupport {
...}

One important things is that I created a package into core module with name “com.haulmont.cuba.core.sys.persistence”.

Next step: Create a personal version of Platform class with 2 essential overrides with sql generation without “left outer join”.

public class CubaLsOraclePlatform extends  CubaOraclePlatform {
    Logger log = LoggerFactory.getLogger("CubaLsOraclePlatform");
    @Override
    public boolean shouldPrintOuterJoinInWhereClause() {
        this.printOuterJoinInWhereClause= Boolean.TRUE;
        return this.printOuterJoinInWhereClause;
    }

    @Override
    public boolean shouldPrintInnerJoinInWhereClause() {
        this.printInnerJoinInWhereClause = Boolean.TRUE;
        return this.printInnerJoinInWhereClause;
    }

    @Override
    public Object convertObject(Object sourceObject, Class javaClass) throws ConversionException {
        if (sourceObject instanceof UUID && javaClass == String.class) {
            return sourceObject.toString().replace("-", "");
        }
        return super.convertObject(sourceObject, javaClass);
    }
}

Last step : add version to app.properties file:
cuba.dbmsVersion_dbname=8

P:S.
For specific Oracle 8i CubaLsOraclePlatform must extends Oracle8Platform. In my case, and for database functions that i need CubaOraclePlatform (that extends Oracle10Platform) work fine.

That’s it!

2 Likes