stacktrace when initializing directory with autoincrementIdField set to true with Nuxeo 5.6

Hi,

I configured a directory with property autoincrementIdField set to true :


<directory name="category">
      <schema>schemacategory</schema>
      <dataSource>java:/nxsqldirectory</dataSource>
      <cacheTimeout>3600</cacheTimeout>
      <cacheMaxSize>1000</cacheMaxSize>
      <table>category</table>
      <idField>id</idField>
      <autoincrementIdField>true</autoincrementIdField>
      <dataFile>directories/category.csv</dataFile>
      <createTablePolicy>always</createTablePolicy>
    </directory>

CSV file category.csv looks like this :

id,label, obsolete, parent
1,"Category 1","0",0
2,"Category 2","0",0
3,"Category 3","0",0

when I start Nuxeo i get the following stacktrace :

2012-08-02 09:50:38,416 ERROR [org.nuxeo.ecm.directory.DirectoryServiceImpl] unrecognized column type: AUTOINC, values: [0: 1, 1: LM France, 2: 0, 3: 0]
org.nuxeo.ecm.directory.DirectoryException: unrecognized column type: AUTOINC, values: [0: 1, 1: Category 1, 2: 0, 3: 0]
        at org.nuxeo.ecm.directory.sql.SQLHelper.loadData(SQLHelper.java:398)
        at org.nuxeo.ecm.directory.sql.SQLHelper.setupTable(SQLHelper.java:127)
        at org.nuxeo.ecm.directory.sql.SQLDirectory.

Should I change something in my CSV file ? I am using PostgreSQL 8.4.

0 votes

1 answers

856 views

ANSWER



Autoincremented values are designed to be generated by the database and our CSV loading code doesn't expect someone to fill them by hand. I understand your need but it's unsupported at the moment. Also you would need some logic to tell the database what id to use for the next insertion after all the CSV has been loaded and we don't have that either.

You may open a JIRA for enhancement. In the meantime you won't be able to use CSV files to load such tables, you'll need to have a DBA do it.

0 votes



OK thanks. FIY i am currently upgrading our apps from 5.4.2 to 5.6 and it seems it was not a problem in 5.4.2.
08/02/2012

I will disable the auto-increment, that will do the trick for a while.
08/02/2012

Autoincrement was mostly broken before Nuxeo 5.5. Please read the NXP-7124 upgrade notes.
08/02/2012