Reputation: 88
I have a problem using Eclipselink 2.2.0 to map an inheritance. Here is my abstract entity:
@Entity
@Inheritance(strategy= InheritanceType.SINGLE_TABLE)
public abstract class Feature extends TenantPossession {
private FeatureType featureType;
@Enumerated(EnumType.STRING)
public FeatureType getFeatureType() {
return featureType;
}
public void setFeatureType(FeatureType featureType) {
this.featureType = featureType;
}
}
The sub class looks like this:
@Entity
public class RecordingFeature extends Feature {
// here some attributes
}
When I save the feature for the first time it works fine. But then when I try to set the feature type and save it, nothing happens.
Feature feature = new RecordingFeature();
feature.setType(FeatureType.RECORDING);
feature = featureService.save(feature); // works fine
...commit transaction and start another transaction...
feature.setType(FeatureType.UNKNOWN);
feature = featureService.save(feature); // seems to work, but type is not set in DB
Does it have something to do with the inheritance? I have another cases in code without inheritance that work fine.
Upvotes: 1
Views: 950
Reputation: 18379
What does save() do? Ensure you are changing the managed version of the object, not a detached object.
Do you have weaving enabled? What happens if you disable weaving (change-tracking)?
Upvotes: 2