Simple fixes (#976)

* Should be only the really simple stuff.
* Final cleanups.
This commit is contained in:
Koen De Groote authored and Rob Bygrave committed 2017-02-23 23:46:51 +13:00
1 parent 8bb884374b
commit 6120a465e1
59 files changed
+111 -125

No files matched your search

@@ -535,7 +535,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
List<Version<T>> versionList = new ArrayList<>();
Version version;
Version<T> version;
while ((version = readNextVersion()) != null) {
versionList.add(version);
}
@@ -544,7 +544,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
return versionList;
}
private Version readNextVersion() throws SQLException {
private Version<T> readNextVersion() throws SQLException {
if (moveToNextRow()) {
return rootNode.loadVersion(this);
@@ -377,11 +377,11 @@ class CQueryBuilder {
PreparedStatement statement = connection.prepareStatement(sql);
predicates.bind(statement, connection);
List<String> propertyNames = new ArrayList<>();
ResultSet resultSet = statement.executeQuery();
ResultSetMetaData metaData = resultSet.getMetaData();
int cols = 1 + metaData.getColumnCount();
List<String> propertyNames = new ArrayList<>(cols - 1);
for (int i = 1; i < cols; i++) {
String tableName = metaData.getTableName(i).toLowerCase();
String columnName = metaData.getColumnName(i).toLowerCase();
@@ -119,7 +119,7 @@ public final class CQueryPlanStats {
return Collections.emptyList();
}
List<MetaQueryPlanOriginCount> list = new ArrayList<>();
List<MetaQueryPlanOriginCount> list = new ArrayList<>(origins.size());
for (Entry<ObjectGraphNode, LongAdder> entry : origins.entrySet()) {
if (reset) {
@@ -31,7 +31,7 @@ import java.util.UUID;
*/
public class DefaultSqlRow implements SqlRow {
static final long serialVersionUID = -3120927797041336242L;
private static final long serialVersionUID = -3120927797041336242L;
private final String dbTrueValue;
@@ -387,7 +387,7 @@ public class SqlTreeBuilder {
} else if (p instanceof BeanPropertyAssoc<?> && p.isEmbedded()) {
// if the property is embedded we need to lookup the real column name
int pos = propName.indexOf(".");
int pos = propName.indexOf('.');
if (pos > -1) {
String name = propName.substring(pos + 1);
p = ((BeanPropertyAssoc<?>) p).getTargetDescriptor().findBeanProperty(name);
@@ -203,9 +203,6 @@ class SqlTreeNodeBean implements SqlTreeNode {
lazyLoadParentId = lazyLoadParentIdBinder.read(ctx);
}
// bean already existing in the persistence context
EntityBean contextBean = null;
Class<?> localType;
BeanDescriptor<?> localDesc;
IdBinder localIdBinder;
@@ -237,6 +234,8 @@ class SqlTreeNodeBean implements SqlTreeNode {
PersistenceContext persistenceContext = (!readId || temporalVersions) ? null : ctx.getPersistenceContext();
// bean already existing in the persistence context
EntityBean contextBean = null;
if (readId) {
Object id = localIdBinder.readSet(ctx, localBean);
if (id == null) {