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

Allow customization of @RevisionTimestamp property name #2850

Open
rpost opened this issue Mar 9, 2023 · 3 comments
Open

Allow customization of @RevisionTimestamp property name #2850

rpost opened this issue Mar 9, 2023 · 3 comments
Labels
type: enhancement A general enhancement

Comments

@rpost
Copy link

rpost commented Mar 9, 2023

Why did you hardcode "timestamp" as revision property in org.springframework.data.envers.repository.support.EnversRevisionRepositoryImpl#findLastChangeRevision ?

My custom revision entity has different @RevisionTimestamp property than timestamp.

This results in org.hibernate.QueryException: could not resolve property: timestamp of:... when org.springframework.data.repository.history.RevisionRepository#findLastChangeRevision is called.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 9, 2023
@mp911de
Copy link
Member

mp911de commented Mar 10, 2023

This change was introduced in spring-projects/spring-data-envers#195.

I agree that this isn't ideal, it would sense to lookup the @RevisionTimestamp property and use its name.

@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 10, 2023
@mp911de mp911de changed the title Hardcoded revision property? Allow customization of @RevisionTimestamp property name Mar 10, 2023
@gregturn
Copy link
Contributor

I've made a cursory scan of the Spring Data Envers code, and can't seem to locate the class type that actually holds the @ RevisionTimestamp-annotated field.

While Spring has utilities to extract such an annotated field and get its name, I must first have the name of the class where that can be found. And that I can't seem to discover (yet).

@jmax01
Copy link

jmax01 commented Dec 9, 2024

Unfortunately, we implemented our solution against 3.3.4 and 3.3.5, which did not force us to use timestamp as the property name.

I may be mistaken, but minor changes to the ReflectionRevisionEntityInformation to detect the correct property name and then a modification of EnversRevisionRepositoryImpl to use that name, if it exists, is all that is required to resolve this.

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

No branches or pull requests

5 participants