-->
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.  [ 2 posts ] 
Author Message
 Post subject: CDI events in JPA callbacks
PostPosted: Wed Dec 13, 2017 11:24 am 
Newbie

Joined: Wed Dec 13, 2017 11:14 am
Posts: 1
Hello.

We are using Hibernate inside WildFly (v10) JEE container.

We use @EntityListeners where we fire a CDI event inside a method annotated with @PreUpdate.

These are the CDI observer methods listening to the events fired in the EntityListener:
Code:
@Asynchronous
public void onSuccess(@Observes(during = TransactionPhase.AFTER_SUCCESS) MyData event) {

@Asynchronous
public void onFailure(@Observes(during = TransactionPhase.AFTER_FAILURE) MyData event) {

What is strange here, is that always the onFailure() method is called although the data is written to the db and no exceptions or any errors can be seen - meaning the transaction has been comitted.
We also use RootAware[1] for the children entities. Don't know, if this matters.

Would be great, if anyone could explain, why this is not working as expected!

Thanks,
Michael


[1] https://vladmihalcea.com/how-to-increme ... hibernate/


Top
 Profile  
 
 Post subject: Re: CDI events in JPA callbacks
PostPosted: Wed Dec 13, 2017 1:15 pm 
Red Hat Associate
Red Hat Associate

Joined: Wed Apr 18, 2012 9:06 pm
Posts: 6
Try adding a call to Thread.dumpStack(), to show the call stack of what called your onFailure(). That should give you an idea of why it is being called. I haven't heard of others hitting this, so not sure why your seeing it.

We also released WildFly 11, so you could try recreating with that (to see if your problem has been fixed), if the above doesn't help.


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