persistence@glassfish.java.net

Re: code reivew for issue 743

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Tue, 22 Aug 2006 15:52:33 +0200

Hi Jielin,

I'm wondering whether we have to distinguish @Embeddable and @Embedded
here. I think an entity class might have an @Embeddable annotation. So
the TypeHelper method taking a type representation should be called
isEmbeddable:
  public boolean isEmbeddable(Object type);

I think we need another TypeHelper method that checks whether a field or
property is annotated with the @Embedded annotation, so something like:
  public Object isEmbeddedAttribute(Object ownerClass, String attribute);
The method is called in the validate method of JoinDeclNode and
FetchJoinNode. The path property of the two nodes is a DotNode. The type
of the left child is the ownerClas, the name of the right child (an
AttributeNode) is the attribute parameter for the call.

I'm not sure how the @Embedded annotation is represented in the TopLink
mapping classes, so I do not know how to implement method
isEmbeddedAttribute. Tom, do you know?

Regards Michael

> Hi, Michael/Tom,
>
> Issue 743 Join of embedded entities should be disallowed is fix in this
> jar. Also the unit test for this issue is included. Would you please
> review the code?
>
> The changes are:
>
> Added isEmbeddedEntity() API.
> entity-persistence/src/java/oracle/toplink/essentials/internal/parsing/TypeHelperImpl.java
>
> entity-persistence/src/java/oracle/toplink/essentials/internal/parsing/TypeHelper.java
>
>
> Added code for check if the entity is embedded or not
> entity-persistence/src/java/oracle/toplink/essentials/internal/parsing/JoinDecNode.java
>
> entity-persistence/src/java/oracle/toplink/essentials/internal/parsing/FetchJoinNode.java
>
>
> Added EJBQL error message:
> entity-persistence/src/java/oracle/toplink/essentials/exceptions/EJBQLException.java
>
> entity-persistence/src/java/oracle/toplink/essentials/exceptions/i18n/EJBQLExceptionResource.java
>
>
> Added unit test
> entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/ejb/ejbqltesting/JUnitEJBQLValidationTestSuite.java
>
>
> Thanks.
>
> Jielin