Skip to content

Commit

Permalink
revert some changes and enabling private foreign key setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Grosner committed Jul 3, 2015
1 parent deb2fa9 commit efb2e42
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ public void writeLoadFromCursorDefinition(BaseTableDefinition tableDefinition, J
// special case for model objects within class
if (!fieldIsModelContainer && !isModelContainerAdapter && isModel) {

ColumnAccessModel columnAccessModel = new ColumnAccessModel(manager, this, isModelContainerAdapter);

for (ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
javaWriter.emitStatement(ModelUtils.getColumnIndex(foreignKeyReference.columnName()));
}
Expand All @@ -397,9 +399,14 @@ public void writeLoadFromCursorDefinition(BaseTableDefinition tableDefinition, J

AdapterQueryBuilder adapterQueryBuilder = new AdapterQueryBuilder().appendVariable(false);
adapterQueryBuilder.append(".")
.append(columnFieldName)
.appendSpaceSeparated("=");
.append(columnAccessModel.getSetterReferenceColumnFieldName());
if (!columnAccessModel.isPrivate()) {
adapterQueryBuilder.appendSpaceSeparated("=");
}
adapterQueryBuilder.append(rawConditionStatement);
if (columnAccessModel.isPrivate()) {
adapterQueryBuilder.append(")");
}
javaWriter.emitStatement(adapterQueryBuilder.getQuery());

javaWriter.endControlFlow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public String getQuery(boolean useCastIfApplicable) {
} else if (fieldIsAModelContainer) {
contentValue.append(columnName)
.append(".")
.appendGetValue(getReferencedColumnFieldName());
.appendGetValue(referencedColumnFieldName);
} else {
if (isForeignKeyField) {
ColumnAccessModel columnAccessModel = new ColumnAccessModel(parentColumnDefinition.getManager(), parentColumnDefinition, isModelContainerAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void write(JavaWriter javaWriter) throws IOException {
.appendCast(accessModel.castedClass)
.append(modelContainerName)
.append(".")
.appendGetValue(accessModel.getReferencedColumnFieldName())
.appendGetValue(accessModel.referencedColumnFieldName)
.append("))");
javaWriter.emitStatement(adapterQueryBuilder.getQuery());

Expand Down

0 comments on commit efb2e42

Please sign in to comment.