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

Improve performance of delete operation #91

Open
mlopezFC opened this issue Apr 30, 2024 · 1 comment
Open

Improve performance of delete operation #91

mlopezFC opened this issue Apr 30, 2024 · 1 comment

Comments

@mlopezFC
Copy link
Member

mlopezFC commented Apr 30, 2024

For what I see in this code, we're converting the dto to an entity just to delete the entity, maybe it would be a good idea to provide a deleteById method, or figure out another way of doing the deletion.

default void delete(S entity) {
T persistentEntity = convertTo(entity);
EntityManager em = getEntityManager();
persistentEntity = em.getReference(getPersistentClass(), persistentEntity.getId());
em.remove(persistentEntity);

@javier-godoy
Copy link
Member

We would need a method to retrieve the persistent id (K) from the DTO S without first converting it to a persistent entity T.

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