persistence@glassfish.java.net

Fixing issue #520

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 31 Mar 2006 17:28:14 -0800

Tom, Guy,

If I fix this issue (see below for the proposed fix and attached changes), I
get an error running unit tests:

toplink.essentials.exceptions.ValidationException
     [junit] Exception Description: Entity name must be unique in a persistence
unit. Entity name [XMLMergeEmployee] is used for the entity classes
[oracle.toplink.essentials.testing.models.cmp3.xml.merge.incompletemappings.owning.Employee]
and [oracle.toplink.essentials.testing.models.cmp3.xml.merge.advanced.Employee].
     [junit] at
oracle.toplink.essentials.exceptions.ValidationException.nonUniqueEntityName(ValidationException.java:510)


The exception seems to be correct, but I'm afraid I missed something...

Please help!

----------------
The proposed fix (other than validation message itself) is this:

Index:
src/java/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/metadata/MetadataProcessor.java,v
retrieving revision 1.12
diff -r1.12 MetadataProcessor.java
33a34
> import oracle.toplink.essentials.descriptors.ClassDescriptor;
947a949,956
> }
>
> // Verify that entity name is not a duplicate
> ClassDescriptor d =
m_session.getProject().getDescriptorForAlias(alias);
> if (d != null) {
> throw ValidationException.nonUniqueEntityName(
> d.getJavaClassName(),
md.getDescriptor().getJavaClassName(),
> alias);

thanks,
-marina