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

Issues with two Repositories that use LockingAndVersioningRepository after locking 1 in each the delete of the lock can be called from either repo #2153

Open
rhhaley opened this issue Oct 11, 2024 · 3 comments

Comments

@rhhaley
Copy link

rhhaley commented Oct 11, 2024

We are using 3.1.4

I have two Repositories that extend LockingAndVersioningRepository after locking 1 in each repo with the same @id (which is the entity_id) in a test then delete of the lock of either it deletes the lock from the lock table.

A little background:
We have two types with content and our goal is to be able to version both.

  1. Products
  2. Attachments

Steps to reproduce the behavior:

  1. Create two entities with @id that are autoincrementing Integers.
  2. Create one of each in a fresh database. This should show that each id is 1.
  3. Lock one.
  4. Check the lock table you should see entity_id will equal 1.
  5. Lock the other but notice the lock owner doesn't get set on the second entity (not seeing any error).
  6. You'll see there is only one lock in the locks table and with the entity_id = 1.
  7. Call unlock on either repository and you'll see the lock in the lock table be deleted.

Is there a way to make the entity_id to use a custom property.

We are an ex Documentum shop and want to us a similar id structure for document based entities.

Let me know if more info is needed.

@rhhaley rhhaley changed the title Issues with two Repositories that use LockingAndVersioningRepository after locking 1 in each the delete of the lock will can be called from either repo Issues with two Repositories that use LockingAndVersioningRepository after locking 1 in each the delete of the lock can be called from either repo Oct 11, 2024
@paulcwarren
Copy link
Owner

paulcwarren commented Oct 16, 2024

Thanks @rhhaley for raising this. You are quite right. I had not considered the case where an application has two (or more) entities with content and I can imagine the existing implementation exhibits the behavior you describe. I think we can make the lock table use a composite key, perhaps. Or construct a "composite" key in the LockingAndVersioningRepository. Where the composite key includes the type name. Let me look into it a little bit.

I didn't quite catch the last comment about using a custom_property though. Can you explain that a little bit more?

@rhhaley
Copy link
Author

rhhaley commented Oct 16, 2024

So with regards to custom_property I was thinking along the lines of instead of id from the entity you could something like the id we geneate but I think using contentId (which is a guid) and entity_id in the locks table is a String could work?

Otherwise a compound index that uses type, class, or entity name and entity_id would work just as well.

@rhhaley
Copy link
Author

rhhaley commented Dec 11, 2024

Hello, I was wondering if this is being worked into a new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants