-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Envers - No audit records for executeUpdate()
PostPosted: Thu Jan 03, 2013 10:00 am 
Newbie

Joined: Thu Jan 03, 2013 9:57 am
Posts: 1
I have 3 ways things get written to the DB
public void create(T object) {
entityManager.persist(object);
}

public void update(T object) {
object = entityManager.merge(object);
}

public int updateStatus(String id, String status) {

final int changes =
entityManager.createQuery("update item set state = :newState," +
" last_modified = current_timestamp" +
" where id = : id ")
.setParameter("newState", status)
.setParameter("id", id)
.executeUpdate();

return changes;
}
The problem I have, is in order to get the Hibernate Envers to actually write the audit records to the corrsponsing x_aud and revinfo DB tables. It only works successfully for '.persist()' or '.merge()'. I cannot get it to work for 'createQuery(...).executeUpdate()'

Am I missing something or does it just not work for this. The problem is, a lot of my code has been written using .executeUpdate and not merge, so really I need this to work with the existing code.

Can anyone help please?


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

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.