Polishing

This commit is contained in:
Juergen Hoeller
2018-06-11 15:01:18 +02:00
parent f39adcf865
commit c04c8a2472
7 changed files with 71 additions and 165 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -151,6 +151,7 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
} }
@Override @Override
@Nullable
public V getOrDefault(Object key, V defaultValue) { public V getOrDefault(Object key, V defaultValue) {
if (key instanceof String) { if (key instanceof String) {
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key)); String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key));
@@ -162,6 +163,7 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
} }
@Override @Override
@Nullable
public V put(String key, @Nullable V value) { public V put(String key, @Nullable V value) {
String oldKey = this.caseInsensitiveKeys.put(convertKey(key), key); String oldKey = this.caseInsensitiveKeys.put(convertKey(key), key);
if (oldKey != null && !oldKey.equals(key)) { if (oldKey != null && !oldKey.equals(key)) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -52,13 +52,12 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData(); ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount(); int columnCount = rsmd.getColumnCount();
Map<String, Object> mapOfColValues = createColumnMap(columnCount); Map<String, Object> mapOfColumnValues = createColumnMap(columnCount);
for (int i = 1; i <= columnCount; i++) { for (int i = 1; i <= columnCount; i++) {
String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i)); String column = JdbcUtils.lookupColumnName(rsmd, i);
Object obj = getColumnValue(rs, i); mapOfColumnValues.put(getColumnKey(column), getColumnValue(rs, i));
mapOfColValues.put(key, obj);
} }
return mapOfColValues; return mapOfColumnValues;
} }
/** /**

View File

@@ -253,7 +253,6 @@ public class TableMetaDataContext {
for (Map.Entry<String, ?> entry : inParameters.entrySet()) { for (Map.Entry<String, ?> entry : inParameters.entrySet()) {
if (column.equalsIgnoreCase(entry.getKey())) { if (column.equalsIgnoreCase(entry.getKey())) {
value = entry.getValue(); value = entry.getValue();
// TODO: break;
} }
} }
} }

View File

@@ -37,6 +37,7 @@ import org.springframework.jdbc.CannotGetJdbcConnectionException;
import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.NumberUtils; import org.springframework.util.NumberUtils;
import org.springframework.util.StringUtils;
/** /**
* Generic utility methods for working with JDBC. Mainly for internal use * Generic utility methods for working with JDBC. Mainly for internal use
@@ -452,7 +453,7 @@ public abstract class JdbcUtils {
*/ */
public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException { public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException {
String name = resultSetMetaData.getColumnLabel(columnIndex); String name = resultSetMetaData.getColumnLabel(columnIndex);
if (name == null || name.length() < 1) { if (!StringUtils.hasLength(name)) {
name = resultSetMetaData.getColumnName(columnIndex); name = resultSetMetaData.getColumnName(columnIndex);
} }
return name; return name;

View File

@@ -28,6 +28,7 @@ import java.sql.Statement;
import java.sql.Types; import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -151,69 +152,37 @@ public class JdbcTemplateTests {
@Test @Test
public void testStringsWithStaticSql() throws Exception { public void testStringsWithStaticSql() throws Exception {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() { doTestStrings(null, null, null, null, (template, sql, rch) -> template.query(sql, rch));
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, rch);
}
});
} }
@Test @Test
public void testStringsWithStaticSqlAndFetchSizeAndMaxRows() throws Exception { public void testStringsWithStaticSqlAndFetchSizeAndMaxRows() throws Exception {
doTestStrings(10, 20, 30, null, new JdbcTemplateCallback() { doTestStrings(10, 20, 30, null, (template, sql, rch) -> template.query(sql, rch));
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, rch);
}
});
} }
@Test @Test
public void testStringsWithEmptyPreparedStatementSetter() throws Exception { public void testStringsWithEmptyPreparedStatementSetter() throws Exception {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() { doTestStrings(null, null, null, null, (template, sql, rch) ->
@Override template.query(sql, (PreparedStatementSetter) null, rch));
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, (PreparedStatementSetter) null, rch);
}
});
} }
@Test @Test
public void testStringsWithPreparedStatementSetter() throws Exception { public void testStringsWithPreparedStatementSetter() throws Exception {
final Integer argument = 99; final Integer argument = 99;
doTestStrings(null, null, null, argument, new JdbcTemplateCallback() { doTestStrings(null, null, null, argument, (template, sql, rch) -> template.query(sql, ps -> {
@Override ps.setObject(1, argument);
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) { }, rch));
template.query(sql, new PreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps) throws SQLException {
ps.setObject(1, argument);
}
}, rch);
}
});
} }
@Test @Test
public void testStringsWithEmptyPreparedStatementArgs() throws Exception { public void testStringsWithEmptyPreparedStatementArgs() throws Exception {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() { doTestStrings(null, null, null, null, (template, sql, rch) -> template.query(sql, (Object[]) null, rch));
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, (Object[]) null, rch);
}
});
} }
@Test @Test
public void testStringsWithPreparedStatementArgs() throws Exception { public void testStringsWithPreparedStatementArgs() throws Exception {
final Integer argument = 99; final Integer argument = 99;
doTestStrings(null, null, null, argument, new JdbcTemplateCallback() { doTestStrings(null, null, null, argument, (template, sql, rch) -> template.query(sql, new Object[] { argument }, rch));
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, new Object[] { argument }, rch);
}
});
} }
private void doTestStrings(Integer fetchSize, Integer maxRows, Integer queryTimeout, private void doTestStrings(Integer fetchSize, Integer maxRows, Integer queryTimeout,
@@ -355,11 +324,8 @@ public class JdbcTemplateTests {
this.thrown.expect(sameInstance(runtimeException)); this.thrown.expect(sameInstance(runtimeException));
try { try {
this.template.query(sql, new RowCallbackHandler() { this.template.query(sql, (RowCallbackHandler) rs -> {
@Override throw runtimeException;
public void processRow(ResultSet rs) {
throw runtimeException;
}
}); });
} }
finally { finally {
@@ -462,7 +428,7 @@ public class JdbcTemplateTests {
final String[] sql = {"A", "B", "C", "D"}; final String[] sql = {"A", "B", "C", "D"};
given(this.statement.executeBatch()).willThrow( given(this.statement.executeBatch()).willThrow(
new BatchUpdateException(new int[] { 1, Statement.EXECUTE_FAILED, 1, new BatchUpdateException(new int[] { 1, Statement.EXECUTE_FAILED, 1,
Statement.EXECUTE_FAILED })); Statement.EXECUTE_FAILED }));
mockDatabaseMetaData(true); mockDatabaseMetaData(true);
given(this.connection.createStatement()).willReturn(this.statement); given(this.connection.createStatement()).willReturn(this.statement);
@@ -530,17 +496,17 @@ public class JdbcTemplateTests {
mockDatabaseMetaData(true); mockDatabaseMetaData(true);
BatchPreparedStatementSetter setter = BatchPreparedStatementSetter setter =
new BatchPreparedStatementSetter() { new BatchPreparedStatementSetter() {
@Override @Override
public void setValues(PreparedStatement ps, int i) public void setValues(PreparedStatement ps, int i)
throws SQLException { throws SQLException {
ps.setInt(1, ids[i]); ps.setInt(1, ids[i]);
} }
@Override @Override
public int getBatchSize() { public int getBatchSize() {
return ids.length; return ids.length;
} }
}; };
JdbcTemplate template = new JdbcTemplate(this.dataSource, false); JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
@@ -739,10 +705,10 @@ public class JdbcTemplateTests {
@Test @Test
public void testBatchUpdateWithListOfObjectArrays() throws Exception { public void testBatchUpdateWithListOfObjectArrays() throws Exception {
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?"; final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
final List<Object[]> ids = new ArrayList<>(); final List<Object[]> ids = new ArrayList<>(2);
ids.add(new Object[] {100}); ids.add(new Object[] {100});
ids.add(new Object[] {200}); ids.add(new Object[] {200});
final int[] rowsAffected = new int[] { 1, 2 }; final int[] rowsAffected = new int[] {1, 2};
given(this.preparedStatement.executeBatch()).willReturn(rowsAffected); given(this.preparedStatement.executeBatch()).willReturn(rowsAffected);
mockDatabaseMetaData(true); mockDatabaseMetaData(true);
@@ -765,11 +731,11 @@ public class JdbcTemplateTests {
@Test @Test
public void testBatchUpdateWithListOfObjectArraysPlusTypeInfo() throws Exception { public void testBatchUpdateWithListOfObjectArraysPlusTypeInfo() throws Exception {
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?"; final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
final List<Object[]> ids = new ArrayList<>(); final List<Object[]> ids = new ArrayList<>(2);
ids.add(new Object[] {100}); ids.add(new Object[] {100});
ids.add(new Object[] {200}); ids.add(new Object[] {200});
final int[] sqlTypes = new int[] {Types.NUMERIC}; final int[] sqlTypes = new int[] {Types.NUMERIC};
final int[] rowsAffected = new int[] { 1, 2 }; final int[] rowsAffected = new int[] {1, 2};
given(this.preparedStatement.executeBatch()).willReturn(rowsAffected); given(this.preparedStatement.executeBatch()).willReturn(rowsAffected);
mockDatabaseMetaData(true); mockDatabaseMetaData(true);
@@ -797,17 +763,11 @@ public class JdbcTemplateTests {
given(this.preparedStatement.executeBatch()).willReturn(rowsAffected1, rowsAffected2); given(this.preparedStatement.executeBatch()).willReturn(rowsAffected1, rowsAffected2);
mockDatabaseMetaData(true); mockDatabaseMetaData(true);
ParameterizedPreparedStatementSetter<Integer> setter = new ParameterizedPreparedStatementSetter<Integer>() { ParameterizedPreparedStatementSetter<Integer> setter = (ps, argument) -> ps.setInt(1, argument.intValue());
@Override
public void setValues(PreparedStatement ps, Integer argument) throws SQLException {
ps.setInt(1, argument.intValue());
}
};
JdbcTemplate template = new JdbcTemplate(this.dataSource, false); JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
int[][] actualRowsAffected = template.batchUpdate(sql, ids, 2, setter); int[][] actualRowsAffected = template.batchUpdate(sql, ids, 2, setter);
assertTrue("executed 2 updates", actualRowsAffected[0].length == 2); assertEquals("executed 2 updates", 2, actualRowsAffected[0].length);
assertEquals(rowsAffected1[0], actualRowsAffected[0][0]); assertEquals(rowsAffected1[0], actualRowsAffected[0][0]);
assertEquals(rowsAffected1[1], actualRowsAffected[0][1]); assertEquals(rowsAffected1[1], actualRowsAffected[0][1]);
assertEquals(rowsAffected2[0], actualRowsAffected[1][0]); assertEquals(rowsAffected2[0], actualRowsAffected[1][0]);
@@ -895,14 +855,9 @@ public class JdbcTemplateTests {
given(this.preparedStatement.executeUpdate()).willReturn(expectedRowsUpdated); given(this.preparedStatement.executeUpdate()).willReturn(expectedRowsUpdated);
PreparedStatementSetter pss = new PreparedStatementSetter() { PreparedStatementSetter pss = ps -> ps.setString(1, name);
@Override
public void setValues(PreparedStatement ps) throws SQLException {
ps.setString(1, name);
}
};
int actualRowsUpdated = new JdbcTemplate(this.dataSource).update(sql, pss); int actualRowsUpdated = new JdbcTemplate(this.dataSource).update(sql, pss);
assertTrue("updated correct # of rows", actualRowsUpdated == expectedRowsUpdated); assertEquals("updated correct # of rows", actualRowsUpdated, expectedRowsUpdated);
verify(this.preparedStatement).setString(1, name); verify(this.preparedStatement).setString(1, name);
verify(this.preparedStatement).close(); verify(this.preparedStatement).close();
verify(this.connection).close(); verify(this.connection).close();
@@ -915,12 +870,7 @@ public class JdbcTemplateTests {
SQLException sqlException = new SQLException(); SQLException sqlException = new SQLException();
given(this.preparedStatement.executeUpdate()).willThrow(sqlException); given(this.preparedStatement.executeUpdate()).willThrow(sqlException);
PreparedStatementSetter pss = new PreparedStatementSetter() { PreparedStatementSetter pss = ps -> ps.setString(1, name);
@Override
public void setValues(PreparedStatement ps) throws SQLException {
ps.setString(1, name);
}
};
this.thrown.expect(DataAccessException.class); this.thrown.expect(DataAccessException.class);
this.thrown.expect(exceptionCause(sameInstance(sqlException))); this.thrown.expect(exceptionCause(sameInstance(sqlException)));
try { try {
@@ -964,11 +914,8 @@ public class JdbcTemplateTests {
this.thrown.expect(SQLWarningException.class); this.thrown.expect(SQLWarningException.class);
this.thrown.expect(exceptionCause(sameInstance(warnings))); this.thrown.expect(exceptionCause(sameInstance(warnings)));
try { try {
t.query(sql, new RowCallbackHandler() { t.query(sql, rs -> {
@Override rs.getByte(1);
public void processRow(ResultSet rs) throws SQLException {
rs.getByte(1);
}
}); });
} }
finally { finally {
@@ -990,11 +937,8 @@ public class JdbcTemplateTests {
// Too long: truncation // Too long: truncation
this.template.setIgnoreWarnings(true); this.template.setIgnoreWarnings(true);
this.template.query(sql, new RowCallbackHandler() { this.template.query(sql, rs -> {
@Override rs.getByte(1);
public void processRow(ResultSet rs) throws java.sql.SQLException {
rs.getByte(1);
}
}); });
verify(this.resultSet).close(); verify(this.resultSet).close();
@@ -1014,11 +958,8 @@ public class JdbcTemplateTests {
this.thrown.expect(BadSqlGrammarException.class); this.thrown.expect(BadSqlGrammarException.class);
this.thrown.expect(exceptionCause(sameInstance(sqlException))); this.thrown.expect(exceptionCause(sameInstance(sqlException)));
try { try {
this.template.query(sql, new RowCallbackHandler() { this.template.query(sql, (RowCallbackHandler) rs -> {
@Override throw sqlException;
public void processRow(ResultSet rs) throws SQLException {
throw sqlException;
}
}); });
fail("Should have thrown BadSqlGrammarException"); fail("Should have thrown BadSqlGrammarException");
} }
@@ -1045,11 +986,8 @@ public class JdbcTemplateTests {
this.thrown.expect(BadSqlGrammarException.class); this.thrown.expect(BadSqlGrammarException.class);
this.thrown.expect(exceptionCause(sameInstance(sqlException))); this.thrown.expect(exceptionCause(sameInstance(sqlException)));
try { try {
template.query(sql, new RowCallbackHandler() { template.query(sql, (RowCallbackHandler) rs -> {
@Override throw sqlException;
public void processRow(ResultSet rs) throws SQLException {
throw sqlException;
}
}); });
} }
finally { finally {
@@ -1082,11 +1020,8 @@ public class JdbcTemplateTests {
this.thrown.expect(BadSqlGrammarException.class); this.thrown.expect(BadSqlGrammarException.class);
this.thrown.expect(exceptionCause(sameInstance(sqlException))); this.thrown.expect(exceptionCause(sameInstance(sqlException)));
try { try {
template.query(sql, new RowCallbackHandler() { template.query(sql, (RowCallbackHandler) rs -> {
@Override throw sqlException;
public void processRow(ResultSet rs) throws SQLException {
throw sqlException;
}
}); });
} }
finally { finally {
@@ -1104,34 +1039,23 @@ public class JdbcTemplateTests {
given(this.connection.createStatement()).willReturn(this.statement); given(this.connection.createStatement()).willReturn(this.statement);
try { try {
this.template.query("my query", new ResultSetExtractor<Object>() { this.template.query("my query", (ResultSetExtractor<Object>) rs -> {
@Override throw new InvalidDataAccessApiUsageException("");
public Object extractData(ResultSet rs) {
throw new InvalidDataAccessApiUsageException("");
}
}); });
fail("Should have thrown InvalidDataAccessApiUsageException"); fail("Should have thrown InvalidDataAccessApiUsageException");
} }
catch (InvalidDataAccessApiUsageException idaauex) { catch (InvalidDataAccessApiUsageException ex) {
// ok // ok
} }
try { try {
this.template.query(new PreparedStatementCreator() { this.template.query(con -> con.prepareStatement("my query"),
@Override (ResultSetExtractor<Object>) rs2 -> {
public PreparedStatement createPreparedStatement(Connection con) throw new InvalidDataAccessApiUsageException("");
throws SQLException { } );
return con.prepareStatement("my query");
}
}, new ResultSetExtractor<Object>() {
@Override
public Object extractData(ResultSet rs2) {
throw new InvalidDataAccessApiUsageException("");
}
});
fail("Should have thrown InvalidDataAccessApiUsageException"); fail("Should have thrown InvalidDataAccessApiUsageException");
} }
catch (InvalidDataAccessApiUsageException idaauex) { catch (InvalidDataAccessApiUsageException ex) {
// ok // ok
} }
@@ -1147,24 +1071,13 @@ public class JdbcTemplateTests {
given(this.callableStatement.execute()).willReturn(true); given(this.callableStatement.execute()).willReturn(true);
given(this.callableStatement.getUpdateCount()).willReturn(-1); given(this.callableStatement.getUpdateCount()).willReturn(-1);
List<SqlParameter> params = new ArrayList<>(); SqlParameter param = new SqlReturnResultSet("", (RowCallbackHandler) rs -> {
params.add(new SqlReturnResultSet("", new RowCallbackHandler() { throw new InvalidDataAccessApiUsageException("");
@Override });
public void processRow(ResultSet rs) {
throw new InvalidDataAccessApiUsageException("");
}
}));
this.thrown.expect(InvalidDataAccessApiUsageException.class); this.thrown.expect(InvalidDataAccessApiUsageException.class);
try { try {
this.template.call(new CallableStatementCreator() { this.template.call(conn -> conn.prepareCall("my query"), Collections.singletonList(param));
@Override
public CallableStatement createCallableStatement(Connection conn)
throws SQLException {
return conn.prepareCall("my query");
}
}, params);
} }
finally { finally {
verify(this.resultSet).close(); verify(this.resultSet).close();
@@ -1175,7 +1088,6 @@ public class JdbcTemplateTests {
@Test @Test
public void testCaseInsensitiveResultsMap() throws Exception { public void testCaseInsensitiveResultsMap() throws Exception {
given(this.callableStatement.execute()).willReturn(false); given(this.callableStatement.execute()).willReturn(false);
given(this.callableStatement.getUpdateCount()).willReturn(-1); given(this.callableStatement.getUpdateCount()).willReturn(-1);
given(this.callableStatement.getObject(1)).willReturn("X"); given(this.callableStatement.getObject(1)).willReturn("X");
@@ -1187,16 +1099,8 @@ public class JdbcTemplateTests {
assertTrue("now it should have been set to case insensitive", assertTrue("now it should have been set to case insensitive",
this.template.isResultsMapCaseInsensitive()); this.template.isResultsMapCaseInsensitive());
List<SqlParameter> params = new ArrayList<>(); Map<String, Object> out = this.template.call(
params.add(new SqlOutParameter("a", 12)); conn -> conn.prepareCall("my query"), Collections.singletonList(new SqlOutParameter("a", 12)));
Map<String, Object> out = this.template.call(new CallableStatementCreator() {
@Override
public CallableStatement createCallableStatement(Connection conn)
throws SQLException {
return conn.prepareCall("my query");
}
}, params);
assertThat(out, instanceOf(LinkedCaseInsensitiveMap.class)); assertThat(out, instanceOf(LinkedCaseInsensitiveMap.class));
assertNotNull("we should have gotten the result with upper case", out.get("A")); assertNotNull("we should have gotten the result with upper case", out.get("A"));
@@ -1205,6 +1109,7 @@ public class JdbcTemplateTests {
verify(this.connection).close(); verify(this.connection).close();
} }
private void mockDatabaseMetaData(boolean supportsBatchUpdates) throws SQLException { private void mockDatabaseMetaData(boolean supportsBatchUpdates) throws SQLException {
DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class); DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class);
given(databaseMetaData.getDatabaseProductName()).willReturn("MySQL"); given(databaseMetaData.getDatabaseProductName()).willReturn("MySQL");

View File

@@ -203,7 +203,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Applies to the CONNECT frame. * Applies to the CONNECT frame.
* @since 5.0.7 * @since 5.0.7
*/ */
public void setAcceptVersion(@Nullable String[] acceptVersions) { public void setAcceptVersion(@Nullable String... acceptVersions) {
if (ObjectUtils.isEmpty(acceptVersions)) { if (ObjectUtils.isEmpty(acceptVersions)) {
set(ACCEPT_VERSION, null); set(ACCEPT_VERSION, null);
return; return;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ public class DefaultPersistenceUnitManager
private static final Set<AnnotationTypeFilter> entityTypeFilters; private static final Set<AnnotationTypeFilter> entityTypeFilters;
static { static {
entityTypeFilters = new LinkedHashSet<>(4); entityTypeFilters = new LinkedHashSet<>(8);
entityTypeFilters.add(new AnnotationTypeFilter(Entity.class, false)); entityTypeFilters.add(new AnnotationTypeFilter(Entity.class, false));
entityTypeFilters.add(new AnnotationTypeFilter(Embeddable.class, false)); entityTypeFilters.add(new AnnotationTypeFilter(Embeddable.class, false));
entityTypeFilters.add(new AnnotationTypeFilter(MappedSuperclass.class, false)); entityTypeFilters.add(new AnnotationTypeFilter(MappedSuperclass.class, false));