Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NPE using Embedded ids?

Actually the more I look at your model, this exception is likely not caused by the @MappedSuperclass and @Embedable declaration together. (Although what Gordon suggested below is what you will need to do to ensure BPK has the mappings from APK)
 
Does your model use generic type specifications anywhere? You made mention to a previous eclipselink mailing list which encountered the same exception. That error was as a result of resolving the generic type incorrectly, this seems to be the same problem.
 
Cheers,
Guy
----- Original Message -----
Sent: Tuesday, January 20, 2009 3:27 PM
Subject: Re: [eclipselink-users] NPE using Embedded ids?

You could remove the @MappedSuperclass annotation then use the @Customizer annotation on BPK to create a Descriptor customizer that adds the mappings for inherited attributes. 

public class MappedSuperClassEmbeddableCustomizer implements DescriptorCustomizer {

    public void customize(ClassDescriptor descriptor) throws Exception {
       
        descriptor.addDirectMapping("<APK.attributeName>", "<getMethodName or null>", "<setMethodName or null>", "<Database Column Name>");

    }

If you want true Embeddable inheritance we can do that too through this customizer but I do not think that is what you are looking for.
--Gordon

konkere wrote:
Guy Pelletier wrote:
  
A class can not be both a mapped superclass and an embeddable.

    
ah yes, hibernate allows that while mentioning in the manual: "The same
notion can be applied to @Embeddable objects to persist properties from
their superclasses. You also need to use @MappedSuperclass to do that (this
should not be considered as a standard EJB3 feature though)".

too bad, gonna go back to using hibernate...
  


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

Back to the top