Need ability to set next available generated primary key value
--------------------------------------------------------------

                 Key: CAY-972
                 URL: https://issues.apache.org/cayenne/browse/CAY-972
             Project: Cayenne
          Issue Type: New Feature
          Components: Cayenne Core Library
    Affects Versions: UNDEFINED FUTURE
            Reporter: Michael Bergens
            Assignee: Andrus Adamchik


Looking at this code, quote- 

    protected String createSequenceString(DbEntity ent) {
        StringBuffer buf = new StringBuffer();
        buf
                .append("CREATE SEQUENCE ")
                .append(sequenceName(ent))
                .append(" START WITH 200") // 200??
                .append(" INCREMENT BY ")
                .append(pkCacheSize(ent));
        return buf.toString();
    }
and similar in all *PkGenerator classes, - how come this 200 is hard-coded? Why 
it's 200?

Anyway, as we implemented data import/export into/from table.xml files using 
Cayenne maps as a guide, now we need to reset the pk generators for generated 
pk columns which are all integer in our case. For now it amounts to having our 
own extension to Cayenne, for each DBMS that we use. As the tables are loaded 
by the import, the loader tracks max PK value for each table loaded and after 
loading is done, it would shoot SQL into the database with a maximum  for each 
table so the next Cayenne operation will provide correct PK value.

Wonder if these next available PK values could be made configurable with 
Cayenne core API?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to