[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Weaving and targetEntity

Hi,

I assume this is the first time you have used our weaving support? (i.e. you are not seeing this issue when converting from dynamic to static weaving)

Our weaving code may not be using targetEntity to account for the fact that your may be using interfaces in your model to represent the relationships. Can you please post the stack trace of one of the exceptions you are seeing?

-Tom

Zeb Ford-Reitz wrote:
Hello,

I'm in the process of adding static weaving to our application and have run into a bit of a problem. All of my relationship targets are interfaces that have a single implementer, so I use the "targetEntity" property liberally in my mapping annotations.

For example, where class B implements interface IB, the getter and setter in class A look like:

    private IB b;

    @OneToOne(cascade = CascadeType.ALL,
              targetEntity = B.class,
              fetch = FetchType.LAZY)
    public IB getB() {
        return b;
    }

    public void setB(IB newB) {
        b = newB;
    }


This worked without any issues until I enabled static weaving. Now, whenever I try to persist an entity, I receive a java.lang.NoSuchMethodException indicating that there is no setter method with the appropriate signature. What confuses me is that (considering the example above) the desired setter method signature is "setB(B)", whereas I would expect it to be "setB(IB)". Am I missing some obvious configuration or setting that would allow the interfaces to be used instead of the concrete classes?



Best regards, Zeb Ford-Reitz


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users