Polymorphic Relationship
Polymorphic Relationship
- Subject: Polymorphic Relationship
- From: remy <email@hidden>
- Date: Fri, 24 Nov 2017 10:30:24 +0000
- Feedback-id: 1.eu-west-1.qLMkdL013duCXQE3E8SaZ3cBmrTvRp8OpMevsMlTH2s=:AmazonSES
Hi,
I want make an polymorphic entity.
I have an Entity Abstract named "EntityAbstract" and a subclass Entity named
"EntitySub" where the qualifier is (refEntityName=‘EntitySub').
I have third Entity named "Relation" that has an relationship with "EntitySub".
I have a problem when :
EOEditingContext editingContext = ERXEC.newEditingContext();
int relationID = Integer.valueOf(relation().primaryKeyInTransaction());
EntityAbstract entityAbstract =
ERXEOControlUtilities.createAndInsertObject(editingContext(),
EntityAbstract.class);
entityAbstract.setRefEntityName(EntitySub.ENTITY_NAME);
entityAbstract.setRefEntityID(relationID);
editingContext().saveChanges();
ERXEOControlUtilities.refreshObject(relation());
for (EntityAbstract e : relation().entitySubs())
System.err.println(e); // Print <your.app.model.EntityAbstract
How to print <Entity pk:"..."> and not <EntityAbstract pk:"..."> ?
I don't want use the class "Entity" for
ERXEOControlUtilities.createAndInsertObject
Do you have an idea?
I tested :
eo.invalidateAllObjects(); eo.parentObjectStore().invalidateAllObjects();
eo.rootObjectStore().invalidateAllObjects();
It does not work...
The project : https://github.com/algodata44/PolymorphicRelationship
<https://github.com/algodata44/PolymorphicRelationship>
Use DB H2
Thx
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden