[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] PROGRESS: Sv: Re: Value of DiscriminatorValue not persisted
|
The problem is that method is called by a ForeignReferenceMapping
passing its reference descriptor:
The problem arises when the actual referenced object is of derived type.
That's obviously a bug.
To fix this, descriptor should be substituted for the correct one:
public ObjectChangeSet findOrCreateLocalObjectChangeSet(Object
entityClone, ClassDescriptor descriptor, boolean isNew){
ObjectChangeSet changes =
(ObjectChangeSet)this.getObjectChangeSetForClone(entityClone);
if (changes == null) {
if (descriptor.hasInheritance() && descriptor.getJavaClass() !=
entityClone.getClass()) {
descriptor =
descriptor.getInheritancePolicy().getDescriptor(entityClone.getClass());
}
if (descriptor.isAggregateDescriptor()) {
changes = new AggregateObjectChangeSet(CacheId.EMPTY,
descriptor, entityClone, this, isNew);
} else {
changes = new
ObjectChangeSet(descriptor.getObjectBuilder().extractPrimaryKeyFromObject(entityClone,
session), descriptor, entityClone, this, isNew);
}
changes.setIsAggregate(descriptor.isDescriptorTypeAggregate());
this.addObjectChangeSetForIdentity(changes, entityClone);
}
return changes;
}
Please log a bug.
Thanks,
Andrei
On 8/20/2013 4:14 PM, Andreas Joseph Krogh wrote:
På tirsdag 20. august 2013 kl. 18:52:25, skrev Andreas Joseph Krogh
<andreak@xxxxxxxxxxxx <mailto:andreak@xxxxxxxxxxxx>>:
På tirsdag 20. august 2013 kl. 18:10:28, skrev Andreas Joseph Krogh
<andreak@xxxxxxxxxxxx <mailto:andreak@xxxxxxxxxxxx>>:
På tirsdag 20. august 2013 kl. 17:28:39, skrev Christopher
Delahunt <christopher.delahunt@xxxxxxxxxx
<mailto:christopher.delahunt@xxxxxxxxxx>>:
Hello Andreas,
Can you provide the stack trace from the debugger where you
noticed the
ObjectBuilder.buildRow was called on the EmailPart
ObjectBuilder/Descriptor? Short of reproducing it locally,
that might
show the code path taken and point to how the wrong
objectbuilder/descriptor is getting used. If you are able
to debug
further, I'd go back from that point and see how that
ObjectBuilder was
looked up.
I think I'm on to something.
This is where UnitOfWorkChangeSet.cloneToObjectChangeSet is
populated with the wrong ObjectChangeSet:
*public**ObjectChangeSet*findOrCreateLocalObjectChangeSet(*Object*entityClone,*ClassDescriptor*descriptor,*boolean*isNew){
*ObjectChangeSet*changes = (*ObjectChangeSet*)*this*.getObjectChangeSetForClone(entityClone);
*if*(changes ==*null*) {
*if*(descriptor.isAggregateDescriptor()) {
changes =*new*AggregateObjectChangeSet(*CacheId*./*EMPTY*/, descriptor, entityClone,*this*, isNew);
}*else*{
changes =*new*ObjectChangeSet(descriptor.getObjectBuilder().extractPrimaryKeyFromObject(entityClone,*session*), descriptor, entityClone,*this*, isNew);
}
changes.setIsAggregate(descriptor.isDescriptorTypeAggregate());
*this*.addObjectChangeSetForIdentity(changes, entityClone);
}
*return*changes;
}
The value of the descriptor is:
RelationalDescriptor(no.officenet.origo.email.domain.model.entities.EmailPart
--> [DatabaseTable(origo_email_part)])
and not EmailSinglePart as I would expect.
I need to figure out why the descriptor sometimes is of the correct
type when adding to the same collection (EmailMessage.rootPartList).
I have an isolated test-case in JAVA now. Will file bug and post link.
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx> mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users