Fixture loads hierachical model incorrectlly
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Fix Released
|
Undecided
|
Unassigned | |||
1.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Below Class design will cause problems while loading yml file by Fixture:
public abstract Class Tag extends Model { ... }
public Class FunctionTag extends Tag { ... }
public abstract Class Post extends Model {
@ManyToMany
public Set<Tag> tags;
......
}
public Class Artical extends Post {
......
}
And we have below yml to initialize data:
FunctionTag(ft1):
......
Artical(a1):
tags: [ft1]
Two problems here:
1. The "resolveDepende
2. After FunctionTag is persisted, the key which is put into "idCache" (e.g models.FunctionTag - ft1) is not the same with the key which generated by "resolveDepende
Below is the proposed solution:
Old Code:
-------
line 135:
line 173:
for (Field field : type.getDeclare
-------
New Code:
-------
line 135:
line 173:
Set<Field> fields = new HashSet<Field>();
Class clazz = type;
while (!clazz.
clazz = clazz.getSuperc
}
for (Field field : fields) { ...... }
-------
Changed in play: | |
status: | Confirmed → Fix Committed |
Changed in play: | |
status: | Incomplete → Fix Committed |
Could you provide a TestCase as well ? It would be great.