-->
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.  [ 3 posts ] 
Author Message
 Post subject: RevisionEntity
PostPosted: Wed Dec 23, 2015 7:27 am 
Newbie

Joined: Mon Feb 01, 2010 9:29 am
Posts: 9
I'm using Hibernate-Core:4.3.11.Final and Hibernate-Envers:4.3.11.Final and I have my implementation of org.hibernate.envers.RevisionListener
and I have my revision entity(MyRevisionEntity) which extend org.hibernate.envers.DefaultRevisionEntity but envers still using default org.hibernate.envers.DefaultRevisionEntity.

Code:
public class MyRevisionListener implements RevisionListener {
@Override
    public void newRevision(Object o) {
        MyRevisionEntity myRev = (MyRevisionEntity) o;
        ..
    }
}


Code:
@Entity
@Table(name = "my_revision")
@RevisionEntity(MyRevisionListener.class)
public class MyRevisionEntity extends DefaultRevisionEntity {

}



What I'm doing wrong?

Then on documentation I find:
Quote:
If your RevisionListener class is inaccessible from @RevisionEntity (e.g. exists in a different module), set org.hibernate.envers.revision_listener property to it's fully qualified name. Class name defined by the configuration parameter overrides revision entity's value attribute.


so I add: org.hibernate.envers.revision_listener: db.MyRevisionListener

but then I get error:
---------------------------
java.lang.ClassCastException: org.hibernate.envers.DefaultRevisionEntity cannot be cast to db.MyRevisionEntity

It is very strange because MyRevisionEntity extend DefaultRevisionEntity .

Any idea?

Regards, Tomaz


Top
 Profile  
 
 Post subject: Re: RevisionEntity
PostPosted: Wed Aug 17, 2016 8:21 am 
Newbie

Joined: Mon Feb 01, 2010 9:29 am
Posts: 9
Even with hibernate-envers:5.1.0.Final and hibernate-core:5.1.0.Final the same error, have any idea?

Using javassist:3.20.0-GA


Top
 Profile  
 
 Post subject: Re: RevisionEntity
PostPosted: Thu Aug 18, 2016 4:23 am 
Newbie

Joined: Mon Feb 01, 2010 9:29 am
Posts: 9
It was my mistake, because MyRevisionEntity wasn't mapped. I'm using dropwizard-hibernate module which need explicitly mapping of entities


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.