Author: echatellier Date: 2010-06-23 18:17:59 +0200 (Wed, 23 Jun 2010) New Revision: 152 Url: http://nuiton.org/repositories/revision/wikitty/152 Log: Fix unique contraints collection type used Set/List Modified: trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java Modified: trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java =================================================================== --- trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java 2010-06-23 15:55:51 UTC (rev 151) +++ trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java 2010-06-23 16:17:59 UTC (rev 152) @@ -448,7 +448,8 @@ } /** - * Create Wikitty from h2 tables + * Create Wikitty from jdbc tables. + * * @param id the id of the wikitty to restore * @param version the version of the wikitty to restore * @param extensionList the list of the extensions of the wikitty to restore @@ -531,8 +532,17 @@ // add fieldList in wikitty for (String fieldName : listFieldMap.keySet()) { Object[] array = listFieldMap.get(fieldName); - List list = new ArrayList(Arrays.asList(array)); - result.setFqField(fieldName, list ); + FieldType type = result.getFieldType(fieldName); + + // EC20100623 check this Set/List depending on unique constraints + if (type.isUnique()) { + Set set = new HashSet(Arrays.asList(array)); + result.setFqField(fieldName, set); + } + else { + List list = new ArrayList(Arrays.asList(array)); + result.setFqField(fieldName, list); + } } return result;