Skip to content

Commit

Permalink
Blazebit#456 - Fixed Blazebit#456 by putting the id in inheritance co…
Browse files Browse the repository at this point in the history
…nstructors first
  • Loading branch information
beikov committed Nov 6, 2017
1 parent 23c58aa commit 5844f56
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,28 @@ private <T> void createInheritanceConstructors(Set<MappingConstructorImpl<T>> co
AbstractMethodAttribute<?, ?>[] subtypeMutableAttributes = new AbstractMethodAttribute<?, ?>[subtypeAttributesClosure.size()];
int subtypeMutableAttributeCount = 0;

// The id attribute always comes first
String idName = null;
int j = 0;
if (inheritanceBase instanceof ViewType<?>) {
idName = ((ViewType<?>) inheritanceBase).getIdAttribute().getName();
CtField field = fieldMap.get(idName);
fields[j] = field;
parameterTypes[j] = field.getType();
j++;
}

for (Map.Entry<ManagedViewTypeImpl.AttributeKey, ConstrainedAttribute<AbstractMethodAttribute<?, ?>>> entry : subtypeAttributesClosure.entrySet()) {
CtField field = fieldMap.get(entry.getKey().getAttributeName());
String attributeName = entry.getKey().getAttributeName();
// Skip the id attribute that we handled before
if (attributeName.equals(idName)) {
continue;
}
CtField field = fieldMap.get(attributeName);
CtClass type;
if (field != null) {
type = field.getType();
} else {
} else {
AbstractMethodAttribute<?, ?> attribute = entry.getValue().getAttribute();
type = pool.get(attribute.getJavaType().getName());
if (attribute.getDirtyStateIndex() != -1) {
Expand Down

0 comments on commit 5844f56

Please sign in to comment.