Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-616

AnnotationRevisionMetadata can't access private fields

    XMLWordPrintable

    Details

    • Sprint:
      55 - Evans SR2

      Description

      Trying to use a custom Envers revision class:

      @Entity
      @RevisionEntity(ExtendedRevisionListener.class)
      @Table(name = "revinfo")
      public class ExtendedRevision implements Serializable {
      
      	@Id
      	@GeneratedValue
      	@Column(name = "REV")
      	@RevisionNumber
      	private Integer id;
      
      	@RevisionTimestamp
      	@Temporal(TemporalType.TIMESTAMP)
      	@Column(name = "REVTSTMP", nullable = false)
      	private Date date;
      
      	@Column(nullable = false, length = 15)
      	private String username;
      
      	public Integer getId() {
      		return id;
      	}
      
      	public Date getDate() {
      		return date;
      	}
      
      	public String getUsername() {
      		return username;
      	}
      
      	public void setUsername(String username) {
      		this.username = username;
      	}
      

      triggers this error:

      java.lang.IllegalStateException: Could not access method: Class org.springframework.util.ReflectionUtils can not access a member of class ExtendedRevision with modifiers "private"
      	at org.springframework.util.ReflectionUtils.handleReflectionException(ReflectionUtils.java:262)
      	at org.springframework.util.ReflectionUtils.getField(ReflectionUtils.java:132)
      	at org.springframework.data.util.AnnotationDetectionFieldCallback.getValue(AnnotationDetectionFieldCallback.java:82)
      	at org.springframework.data.history.AnnotationRevisionMetadata.<init>(AnnotationRevisionMetadata.java:54)
      

      I assume the fields have to be made accessible from the field callback.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            shadow Andrei Ivanov
            Last updater:
            Oliver Drotbohm
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: