Community
Participate
Working Groups
Build Identifier: In eclipselink implementation of JPA 2.0 metamodel API, PluralAttribute.getJavaType() returns the element type instead of the collection type. Here's the snippet: org.eclipse.persistence.internal.jpa.metamodel.PluralAttributeImpl.java: /** * Return the Java type of the represented attribute. * @return Java type */ @Override public Class<C> getJavaType() { return (Class<C>)elementType.getJavaType(); } Is this what the specification means, or just a bug? I have checked the source code of hibernate, they choose to return the collection type from the method. I think this make sence because for a PluralAttribute, we have getElementType method there. I'm working on eclipselink-2.0.2.v20100323-r6872 Reproducible: Always
Setting target and priority. See the following page for details of the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
>I will check with open design issues in the base bug# 266912
>This is a bug, the return class is of type C which is not the element type of the collection V >in public abstract class PluralAttributeImpl<X, C, V> extends AttributeImpl<X, C> implements PluralAttribute<X, C, V> { >we should be using * @param <C> The type of the represented collection >not * @param <V> The element type of the represented collection >The specification does not go into details of the implementation beyond the javadoc for the function above = "represented attribute" >However, check the javadoc for getBindableJavaType() - here we return the elementType - we will need to discuss what the spec means by elementType and our own internal view of what the elementType instance variable is - and how they differ * If the bindable type of the object is <code>PLURAL_ATTRIBUTE</code>, * the Java element type is returned. If the bindable type is public Class<V> getBindableJavaType() { >Regression testing will be affected by... - this will affect functionality of implementor IdentifiableType.getIdType() - open bug # 289487 [DatabaseField type and typeName different for @BasicMap with @ObjectTypeConverter ] will be affected https://bugs.eclipse.org/bugs/show_bug.cgi?id=289487 http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_83:_20090914:_MapAttributeImpl.elementType_incorrectly_set_when_.40ObjectTypeConverter_is_present - Non initialized attributes like Collection aList http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_58:_20090807:_ManagedType_Attribute_Initialization_must_differentiate_between_Collection_and_List - lazy initialization http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_59:_20090818:_PluralAttribute.elementType_not_set_for_non-lazy_instantiated_Collection_Attribute
>This is design issue 104
http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_104:_20100614:_314906:_PluralAttribute.getJavaType_returns_elementType_instead_of_Collection_Type
Created attachment 171844 [details] 314906 PluralAttribute.getJavaType() now returns collection Java type not elementType >Add 3 new tests, extended/modified 7 others >Test results TEST MODEL NAME: (JUnit test): MetamodelMetamodelTest Errors: (failures): 0 Fatal Errors: (errors): 0 Passed: 127 Total Tests: 127 TEST MODEL NAME: (JUnit test): Criteria Errors: (failures): 0 Fatal Errors: (errors): 0 Passed: 141 Total Tests: 141
>patch posted for eclipselink-dev review http://dev.eclipse.org/mhonarc/lists/eclipselink-dev/msg04414.html
>Eclipselink-RT newsgroup posting found - I will reply with final decision shortly. http://www.eclipse.org/forums/index.php?t=msg&th=169029&start=0&
>It has been majority decided that we will make this change in the patch PluralAttribute.getJavaType() will return the Collection interface class (one of Collection.class, Set.class, List.class and Map.class)
>To summarize: "represented attribute" is the PluralAttribute data structure (Set,List,Map or Collection) >See SVN Rev# 7618 for Trunk EclipseLink 2.2 http://fisheye2.atlassian.com/changelog/eclipselink/?cs=7618 >EclipseLink 2.1.1 will be packported when the stream opens shortly Code Reviewed by: Guy Pelletier JPA 2.0 specification adherence reviewed by: Gordon Yorke, James Sutherland and Mike Keith
>P1 is the temporary holder for 2.1.1 queued ports
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink