Replies: 1 comment
-
For your view model, create a custom data store and transaction that inherits from the JPA store. This store will bind your view model whereas the default JPA store should be configured to bind all but this model. In your custom data store transaction, override delete or any other model mutations to delete from the underlying model/table. That will allow you to delete From a view. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lets say I have 2 tables called consignments table(annotated with Table) and consignment_order_lines table. There is a view called consignments_list_view(annotated with Secondarytable) referenced from table consignments and consignment_order_lines. The requirement is to delete the record from consignments_list_view and the 2 tables. I can create a record in 2 tables and a view.
But I am unable to delete a record from view and 2 tables, while I try to delete through elide API, it returns SQL Exception
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: View or function 'consignments_list_view' is not updatable because the modification affects multiple base tables.
Is there any suggestions/solutions to fix this issue?
Example:
@include(name = "consignments", rootLevel = true)
@Getter
@Setter
@entity
@table(name = "consignments_list_view")
@SecondaryTable(name = "consignments")
@FieldNameConstants
@LifeCycleHookBinding(operation = CREATE, phase = PRECOMMIT, hook = ConsignmentsService.class)
@LifeCycleHookBinding(operation = CREATE, phase = PREFLUSH, hook = ConsignmentsService.class)
public class Consignments extends BaseModel implements Serializable {
}
Beta Was this translation helpful? Give feedback.
All reactions