The buildIndex() magic expects an array of colums, not a list.
This commit is contained in:
@@ -40,6 +40,7 @@ import com.google.common.collect.Maps;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayUtil;
|
import com.samskivert.util.ArrayUtil;
|
||||||
|
import com.samskivert.util.StringUtil;
|
||||||
import com.samskivert.util.Tuple;
|
import com.samskivert.util.Tuple;
|
||||||
|
|
||||||
import com.samskivert.jdbc.ColumnDefinition;
|
import com.samskivert.jdbc.ColumnDefinition;
|
||||||
@@ -229,14 +230,15 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
// add any indices needed for uniqueness constraints
|
// add any indices needed for uniqueness constraints
|
||||||
for (UniqueConstraint constraint : entity.uniqueConstraints()) {
|
for (UniqueConstraint constraint : entity.uniqueConstraints()) {
|
||||||
List<ColumnExp> colExps = Lists.newArrayList();
|
ColumnExp[] colExps = new ColumnExp[constraint.fields().length];
|
||||||
|
int ii = 0;
|
||||||
for (String field : constraint.fields()) {
|
for (String field : constraint.fields()) {
|
||||||
FieldMarshaller<?> fm = _fields.get(field);
|
FieldMarshaller<?> fm = _fields.get(field);
|
||||||
if (fm == null) {
|
if (fm == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Unknown unique constraint field: " + field);
|
"Unknown unique constraint field: " + field);
|
||||||
}
|
}
|
||||||
colExps.add(new ColumnExp(_pClass, field));
|
colExps[ii ++] = new ColumnExp(_pClass, field);
|
||||||
}
|
}
|
||||||
_indexes.add(buildIndex(constraint.name(), true, colExps));
|
_indexes.add(buildIndex(constraint.name(), true, colExps));
|
||||||
}
|
}
|
||||||
@@ -1118,6 +1120,11 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
pkColumns.add(rs.getString("COLUMN_NAME"));
|
pkColumns.add(rs.getString("COLUMN_NAME"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return StringUtil.fieldsToString(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The persistent object class that we manage. */
|
/** The persistent object class that we manage. */
|
||||||
|
|||||||
Reference in New Issue
Block a user