Skip to content
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

ElementCollection causes unfortunate primary keys in CollectionTable #861

Closed
S-Tim opened this issue Sep 6, 2023 · 1 comment
Closed
Labels
help wanted Extra attention is needed Type: enhancement New feature or request

Comments

@S-Tim
Copy link
Contributor

S-Tim commented Sep 6, 2023

Scenario

  • camunda-bpm-taskpool version: any
  • Camunda BPM version: any
  • When generating the DDLs for the JPA view using mvn -Pgenerate-sql -f view/jpa as stated in the docs the primary keys of the collection tables of the element collections are unfortunate in some cases.

Current Behaviour

Usually for JPA providers the primary key for every collection table (@CollectionTable) for an element collection (@ElementCollection) consists of all the fields specified in the joinColums as well as every field in the @Embeddable.
See also JPA Wikibooks. This can cause problems for complex embeddables because the index for the primary key might become too large. For example, for MariaDB (with InnoDB) the maximum size of an index is 767bytes. Source.
This means, that the combination of task_id, path and value in plf_task_payload_attributes cannot exceed this limit, thereby greatly limiting the possible size of the value.

There also seems to be no validation regarding the length of the value in Polyflow when writing to the plf_task_payload_attribute table. An error is visible in the log but of course the update does not happen.

Wanted Behaviour

It would be nice to allow for larger values. This could be achieved by converting the element collection to a one-to-many relationship and specifying the primary key manually as the combination of task_id and path source. Although this would hurt the performance because the value would not be part of any index anymore and specifying another index with all three fields faces the same limitations as the index for the PK. Maybe an index on the task_id and path would be enough to quickly find the right row.
Maybe something like a full-text index could solve this issue

@S-Tim S-Tim added Type: enhancement New feature or request help wanted Extra attention is needed labels Sep 6, 2023
@S-Tim
Copy link
Contributor Author

S-Tim commented Sep 6, 2023

relates to #794. Won't fix for now

@S-Tim S-Tim closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant