solomax commented on code in PR #130:
URL: https://github.com/apache/openjpa/pull/130#discussion_r2067851295
##########
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestIndices.java:
##########
@@ -69,12 +69,15 @@ public void testIndicesCreated() {
// test multi column index without spaces
assertIndexColumns(table, "idx_with_spaces", "LONG_NAME", "COL2",
"COL3");
+
+ // test indexes without defined name
+ assertHasIndexWithColumns(table, "LONG_NAME", "COL2");
}
private void assertIndexColumns(Table table, String indexName, String...
assertedColumnNames) {
Index idx = table.getIndex(DBIdentifier.newIndex(indexName));
assertNotNull("Defined index should exist", idx);
-
+
Review Comment:
these white spaces looks redundant :)
##########
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java:
##########
@@ -948,10 +950,11 @@ protected Index createIndex(MetaDataContext context,
String prefix,
// if no name provided by user info, make one
if (DBIdentifier.isNull(name)) {
- if (tmplate != null)
+ if (tmplate != null &&
!DBIdentifier.isNull(tmplate.getIdentifier()))
Review Comment:
I would add missing `{}` here and in tests :)
##########
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/TestIndices.java:
##########
@@ -83,4 +86,23 @@ private void assertIndexColumns(Table table, String
indexName, String... asserte
assertTrue("Column " + assertedColumnName + " does not exist in
index " + indexName, indexColumnNames.contains(assertedColumnName));
}
}
+
+ private void assertHasIndexWithColumns(Table table,
String...assertedColumnNames) {
+ for (Index idx: table.getIndexes()) {
+ Column[] cols = idx.getColumns();
Review Comment:
I guess here is the mixture of tabs and spaces ....
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]