I tried creating an Entity with a nullable @ManyToOne relationship using a @JoinTable. While JPA supports this just fine, I ran into problems when trying to Implement a EclipseLink's HistoryPolicy using an EntityCustomizer.
I wanted to do this:
ManyToOneMapping mapping = (ManyToOneMapping)descriptor.getMappingForAttributeName(FIELD_NAME);
mapping.setHistoryPolicy(...);
Alas, ManyToOneMapping has no setHistoryPolicy() method....it just isn't an implemented feature.
I searched the Web and found little help. Documentation for HistoryPolicy is very light. I did find some suggestions that HistoryPolicy only supports some mappings but not others.
Conclusion: ManyToOne relationships with a JoinTable are not compatible with HistoryPolicy. My workaround is to use a nullable JoinColumn for this relationship.
No comments:
Post a Comment