see my comments below..

On Sat, Nov 9, 2013 at 1:38 AM, zeeman <[email protected]> wrote:

>
> @Inject
> private EntityManager em;
>
> @Inject
> private SocialNotificationHandler notificationHandler;
>
> @Transactional
> public void saveLlikeAction(){
>
> em.persist(new LikeObject(memInfo));
> notificationHandler.handleAsyncSocialLike(memId);
>
> }
>
>
1. interesting, you are using EntityManager inside @ViewScoped bean, when
it is recommended to do this in (@Stateless) @EJB

2. you are trying to entityManager.persist(some object retrieved by an
@Singleton @Asynchronous method call; see below)


>
> @Singleton
> public class SocialNotificationHandler implements Serializable {
>
> @PersistenceContext(unitName = PersistenceConfiguration.UNIT_NAME)
> private EntityManager entityManager;
>
>         @Asynchronous
>         public void handleAsyncSocialLike(UUID memId) {
>
>                         MemberSocialNotification notification = new
> MemberSocialNotification(memId);
>                         entityManager.persist(notification);
>
>
>         }
>
> }
>
>
below, tells me that your @Singleton @Asynchronous is the cause.


>
>
> A second error caused by something else but the same root cause:
>
> INFO: HHH000327: Error performing load command :
> org.hibernate.exception.GenericJDBCException: could not prepare statement
> Nov 8, 2013 7:46:51 PM
> org.apache.openejb.core.transaction.EjbTransactionUtil
> handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: could not prepare
> statement
> org.hibernate.exception.GenericJDBCException: could not prepare statement
>

<snip>

>         at
> com.sportivity.model.Member_$$_jvst9fb_1e.equals(Member_$$_jvst9fb_1e.java)
>         at
>
> com.sportivity.services.handlers.SocialNotificationHandler.handleAsyncSocialLike(SocialNotificationHandler.java:125)
>
</snip>

my recommendation is @Stateless @EJB (and no @Asynchronous) instead of
@Singleton @Asynchronous.

i have seen tomee committers say that @Asynchronous...you don't know
if/when it is going to execute or not.

Reply via email to