persistence@glassfish.java.net

part of an embedded object is read-only...

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Mon, 07 Aug 2006 19:56:40 +0530

(Resending as the earlier email which had a wrong subject.)

Hi Tom, Gordon,

I am looking into issue
https://glassfish.dev.java.net/issues/show_bug.cgi?id=894 . Looking at
the code I see that the metadata processing code is correctly processing
the insertable and updatable values that are specified in the Embeddable
class. An *AggregateObjectMapping* type of mapping is also created for
the embedded field. The bug seem to be in ObjectBuilder.java which is
reporting an incorrect exception. See code below from ObjectBuilder.java:
    public void initialize(AbstractSession session) throws
DescriptorException {
            ...
                if (!mapping.isReadOnly()) {
                    if (getMappingsByField().containsKey(field)) {
                        // We cannot determine if aggregate mapping for
the field are read-only, so ignore exception.
                        if (!mapping.isAggregateObjectMapping()) {
                            
session.getIntegrityChecker().handleError(DescriptorException.multipleWriteMappingsForField(field.toString(),
mapping));
                        }
                    }
            ...

As you can see, from the above code, it is checking if the
AggregateObjectMapping is readonly or not. Should it not instead check
individual mapping objects that are part of the AggregateObjectMapping?
What I don't understand is why is their a boolean type field called
*isReadOnly* on an AggregateObjectMapping. What is the semantics of that
boolean flag? /Does TopLink Essential not support a part of an embedded
object to be read-only?/

Thanks,
Sahoo