-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity view for partial updates #127
Comments
POC implemented by 27417ef |
Works for simple attributes, but collection updates and cascading updates aren't implemented yet. |
Also there is no support for subviews yet |
Updatable entity viewsUpdating should be adaptive by default. If we can avoid loading the entity, we use an update query. If collections are affected, we must load the entity and replay collection changes. The originally planned features are
Version field supportThis is a bit tricky as it requires special attention when doing collection updates on partial enabled entity views. Normally updates of basic and *ToOne fields would be done with an update query, but when collection updates are also involved, we have to take special care regarding the version update. *ToMany and element collection supportSince *ToMany and element collection updates can only be implemented with JPA by changing a persistent entity, we will implement these modifications similar to the following example
To efficiently implement collection semantics, one would have to track changes done to a collection. Since the JPA provider does that already, I am thinking of a lightweight tracking mechanism. The best that I have been able to come up with was tracking method calls to the collection and replaying them on the collection of the entity. Updateable subviewsSupporting updateable subviews requires some change to the change recognition as we have to go into the subview and check for changes there too. This shouldn't be a big deal, but then again, the version field semantics have to be tested. Cascading updates of relations and subviewsSubviews can be supported automatically as we are tracking changes to them, but when having *ToOne relations mapped in the entity view, it's not so easy. Setters with modifier protected/default for use in user methodsA user might want to declare public action methods which mutate the state by calling setters in a more domain driven way. Since the setters would not have to be exposed to be able to call them within such a action method, we should allow to use the modifiers protected/default for setters. Access to modified stateAnother feature that will differentiate updatable entity views from entities is the support for getting access to the changed state. It should be at least possible to query the metamodel attributes of an instance that changed. Getting access to the original state or the current DB state vs. the state of the updatable entity view might also be considered. Field access strategyEntities that use the field access strategy should also be supported. Currently the flushing of values to an entity instance only work when getters/setters are available. It should also be possible to use entity types that use the field access strategy. Make sure this works with bytecode enhanced entities. Configuration of flush strategyIt might be desirable to always use the entity reference flush strategy so allow this behavior to be fine tuned. Entity Id mapping for all relation typesInstead of requiring to map the entity types or subview types, it might be desireable to be able to map the id of the target type instead. Constraint violation exception mapping integrationIntegrate support for constraint violation exception mapping via #170 to enrich the exceptions with entity view related information. Maybe we can even provide a declarative way for exception mapping? Dynamically generated delegating proxy classesApart from our very efficient proxy classes, we also have to generate proxy classes that do delegation to instances of a compatible type. In case of updateable entity views, the delegating proxy class also has to implement the It should be possible to create an entity view A by
|
Moving this to 1.2.0 because the scope has been broadened too much already. |
Moving to 1.4.0 as the experimental version is already done. |
Closing as most of the thing are done. I created issues for the other stuff. |
We could add some more annotations for entity views and extend the entity view manager to allow partial updates to the entities they map to.
Need support for version fields too. Note that for now, only updates are considered.
The text was updated successfully, but these errors were encountered: