Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336599 - EclipseLink2.1.2: metadata processing: use of custom property annotaton causes: "Mapping annotations cannot be applied to fields or properties that have a @Transient specified."
Summary: EclipseLink2.1.2: metadata processing: use of custom property annotaton cause...
Status: RESOLVED DUPLICATE of bug 330395
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-08 05:30 EST by darren CLA
Modified: 2022-06-09 10:30 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description darren CLA 2011-02-08 05:30:52 EST
Build Identifier: 

In a base Element entity I have a transient property util with type Util, where Util performs reflection services. I also (for other purposes) have custom getter annotations such as @NoviceProperty, @ExpertProperty, @SystemProperty.

@Entity
abstract public class Element implements Serializable {

..

    private Util util;

    //@SystemProperty
    @Transient
    public Util getUtil() {
        if (util == null) {
            util = new Util(this);
        }
        return util;
    }

    public class Util {
        private WrapDynaClass dynaClass;
        ..
    }
}

This works fine with EclipseLink2.0.1.

But when I use the custom annotations, EclipseLink2.1.2 gives the following error:

Mapping annotations cannot be applied to fields or properties that have a @Transient specified. [method getUtil] is in violation of this restriction.
at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:373) 

Commenting out the custom annotation @SystemProperty removes the error.

Reproducible: Always

Steps to Reproduce:
1. Create a custom method (getter) annotation.
2. Apply it to a @Transient property getter of a entity.
3. Try to deploy the web application to Glassfish3.0.1.

For me this is a major feature break, as I need this powerful transient Util property in my base class.
Comment 1 Tom Ware CLA 2011-02-10 09:42:06 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Guy Pelletier CLA 2011-02-10 09:54:18 EST
This is a duplicate of bug 330395 and will be available in 2.1.3

In the mean time, you can mark the util property as transient in XML and remove
the @Transient from the class to get around the issue.

*** This bug has been marked as a duplicate of bug 330395 ***
Comment 3 darren CLA 2011-02-13 19:35:22 EST
@tom
@guy

thanks for feedback and duplicate identification and XML workaround tip, darren
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:30:40 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink