hibernate-envers

Envers @OneToMany audit on CREATE(0) but not on DELETE(2)

大兔子大兔子 提交于 2020-01-15 12:44:48
问题 I've looked a quite a few similar issues like: http://community.jboss.org/message/580407#580407 but haven't found a solution yet. An Activity has many Occurences, when an occurence is created the activity_occurence_AUD table is updated correctly with a 0 (create) revision. However when an occurance is removed the activity_occurence_AUD table is not populated with a 2 (delete) revision. Activity Entity: @Entity @Table(name = "activity") @Audited public class Activity implements Serializable {

Envers @OneToMany audit on CREATE(0) but not on DELETE(2)

感情迁移 提交于 2020-01-15 12:44:46
问题 I've looked a quite a few similar issues like: http://community.jboss.org/message/580407#580407 but haven't found a solution yet. An Activity has many Occurences, when an occurence is created the activity_occurence_AUD table is updated correctly with a 0 (create) revision. However when an occurance is removed the activity_occurence_AUD table is not populated with a 2 (delete) revision. Activity Entity: @Entity @Table(name = "activity") @Audited public class Activity implements Serializable {

HIbernate Envers: retrieve snapshots inserted in the same transaction

醉酒当歌 提交于 2020-01-06 08:44:08
问题 We've got a requirement: log and persist the entity changes in the transaction in terms of diff using Hibernate Envers. We implemented a RevisionListener : public class MyRevisionListener implements EntityTrackingRevisionListener { @Override public void newRevision(Object revision) { ... } @Override public void entityChanged(Class entityClass, String entityName, Serializable entityId, RevisionType revisionType, Object revisionEntity) { int revisionId = ((DefaultRevisionEntity) revisionEntity)

how to get OneToMany relationship revision in Hibernate envers

谁都会走 提交于 2020-01-06 05:53:12
问题 we have two entities like Resource and NonFTECost. And we have relationship between these is OneToMany bi-directional. below is the entities @Getter @Setter @NoArgsConstructor @Entity @Table public class Resource { @NotNull @Column(name = "NAME", nullable = false, length = 255) @Audited(withModifiedFlag = true) private String name; @OneToMany(mappedBy = "resource", cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) @Audited private List<NonFTECost> costings = new ArrayList<>(); //other

hibernate envers throw entity not found exception, when audit table doesn't have record with ID

旧城冷巷雨未停 提交于 2020-01-06 05:20:25
问题 Account Entity @Getter @Accessors(chain = true, fluent = true) @NoArgsConstructor @AllArgsConstructor(staticName = "of") @ToString(of = {"customerName"}, callSuper = true) @Entity @Table(name = "ACCOUNTS", uniqueConstraints = @UniqueConstraint(name = UNQ_CUSTOMER_NAME, columnNames = { "CUSTOMER_NAME" }), indexes = { @Index(name = IDX_CUSTOMER_ENTITY, columnList = "CUSTOMER_ENTITY") } ) public class Account extends BaseAutoAssignableVersionableEntity<String, Long> implements Diffable<Account>

Why does overriding change column names

时光毁灭记忆、已成空白 提交于 2020-01-04 04:00:04
问题 I was using the default implementation of the rev listener and as expected the columns in my REVINFO table were: revtstmp and rev. However, when I overrode the default - all I did was: ... MyRevisionEntity extends DefaultRevisionEntity those column names were changed to "timestamp" and "id". Anyone know why? Using envers 4.1.5_Final... ** EDIT ** As no one has yet answered, I am adding more information. The Adam Warski authored "DefaultRevisionEntity" class defines only two members: private

Why does overriding change column names

大兔子大兔子 提交于 2020-01-04 03:59:31
问题 I was using the default implementation of the rev listener and as expected the columns in my REVINFO table were: revtstmp and rev. However, when I overrode the default - all I did was: ... MyRevisionEntity extends DefaultRevisionEntity those column names were changed to "timestamp" and "id". Anyone know why? Using envers 4.1.5_Final... ** EDIT ** As no one has yet answered, I am adding more information. The Adam Warski authored "DefaultRevisionEntity" class defines only two members: private

How to retrieve audited register with relationship @ManyToOne using Hibernate Envers

不羁岁月 提交于 2020-01-01 06:27:14
问题 I´m doubt about using Hibernate Envers and my class. I have a class Loja . @Entity @Audited @GenericGenerator(name = "Sequence_Generic", strategy = "com.paradigma.ecred.dao.hibernate.generator.ManualGenerator") // sequence generic criado para a atividade 510 @SelectBeforeUpdate @DynamicUpdate public class Loja extends Persistent { @Trim @NotBlank(message = "O preenchimento do campo \"CNPJ\" é obrigatório.") @CNPJ(message = "O \"CNPJ da loja\" é inválido") private String cnpj; @Trim @NotBlank

How to retrieve audited register with relationship @ManyToOne using Hibernate Envers

蓝咒 提交于 2020-01-01 06:26:26
问题 I´m doubt about using Hibernate Envers and my class. I have a class Loja . @Entity @Audited @GenericGenerator(name = "Sequence_Generic", strategy = "com.paradigma.ecred.dao.hibernate.generator.ManualGenerator") // sequence generic criado para a atividade 510 @SelectBeforeUpdate @DynamicUpdate public class Loja extends Persistent { @Trim @NotBlank(message = "O preenchimento do campo \"CNPJ\" é obrigatório.") @CNPJ(message = "O \"CNPJ da loja\" é inválido") private String cnpj; @Trim @NotBlank

How to manage object revisions in Grails?

流过昼夜 提交于 2020-01-01 04:04:31
问题 I need to implement a revision system for articles in my grails web app. After searching grails forum, stackoverflow, grails plugins and googling internet, I have ended up with 3 options: Option 1 - Using the grails Envers plugin (see http://code.google.com/p/grails-envers-plugin/). Has anyone used it successfully? Or using Envers without the plugin (see here) but how can I make it work with GORM? Option 2 - Using the Gvers plugin I have found out here: https://github.com/ziftytodd/gvers. I