-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Audit subclass not persists revtype
PostPosted: Tue Oct 18, 2016 12:24 pm 
Newbie

Joined: Tue Oct 18, 2016 12:19 pm
Posts: 3
In my project I have an abstract super class and a subclass (Product and SpecialProduct) both are audited, when I persiste, merge or delete SpecialProduct evenrs put a revtype in Product but put null in revtype for SpecialProduct.

Anybody can help me with this issue?

Thanks


Top
 Profile  
 
 Post subject: Re: Audit subclass not persists revtype
PostPosted: Wed Oct 19, 2016 9:36 am 
Hibernate Team
Hibernate Team

Joined: Wed Jun 15, 2016 9:04 am
Posts: 24
I tested several scenarios and could not reproduce your entity mappings.

Could you please provide your annotated class mappings of Product and SpecialProduct, e.g. how you've defined the inheritance, discriminator values, etc. If you could also provide me with what version of Hibernate and Envers you're using?


Top
 Profile  
 
 Post subject: Re: Audit subclass not persists revtype
PostPosted: Wed Oct 19, 2016 9:49 am 
Newbie

Joined: Tue Oct 18, 2016 12:19 pm
Posts: 3
I'm using version 4.3.7.Final for both (hibernate and envers).

My class are:

Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Audited(targetAuditMode=RelationTargetAuditMode.NOT_AUDITED, modStore=ModificationStore.FULL)
public class Product implements Serializable {
    @Id
    @SequenceGenerator(name="PRODUCT_IDPRODUCT_GENERATOR", sequenceName="PRODUCT_ID_PRODUCT_SEQ", allocationSize=1, initialValue=1)
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PRODUCT_IDPRODUCT_GENERATOR")
   @Column(name="id_product")
   private Long idProduct;
   //fields
}


Code:
@Entity
@Table(name="special_product")
@PrimaryKeyJoinColumn(name="id_product")
@Audited(targetAuditMode=RelationTargetAuditMode.NOT_AUDITED, modStore=ModificationStore.FULL)
public class SpecialProduct{
   //fields
}


Top
 Profile  
 
 Post subject: Re: Audit subclass not persists revtype
PostPosted: Fri Oct 21, 2016 9:33 am 
Hibernate Team
Hibernate Team

Joined: Wed Jun 15, 2016 9:04 am
Posts: 24
Does any of your SpecialProduct audit rows contain a REVTYPE value at all?

If some of them do, I can only suspect that either SpecialProduct may not have participated in JOINED inheritance at one point in time and now it does or maybe the schema was created by a much earlier version of Hibernate Envers that no longer behaves in this fashion. If none of them do, then that likely leads me to think the database schema was created manually and thus incorrectly.

Testing under 4.3.7.Final through 5.2.3.Final with the entity mappings you described, I do not see Hibernate Envers construct a SpecialProduct mapping that contains a REVTYPE field. This field is only added as a part of the Product base table. Given your entity mappings, its safe to simply remove said column from the SpecialProduct audit table as Envers doesn't use it.


Top
 Profile  
 
 Post subject: Re: Audit subclass not persists revtype
PostPosted: Fri Oct 21, 2016 11:34 am 
Newbie

Joined: Tue Oct 18, 2016 12:19 pm
Posts: 3
Ok, thanks for yours kindness, I consulted my team and this table was create manually.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.