[seam-issues] [JBoss JIRA] (SEAMPERSIST-67) LazyInitializationException threw when persist a Many to Many collection of an entity.

Jason Porter (Commented) (JIRA) jira-events at lists.jboss.org
Tue Nov 8 11:12:45 EST 2011

    [ https://issues.jboss.org/browse/SEAMPERSIST-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641141#comment-12641141 ] 

Jason Porter commented on SEAMPERSIST-67:

Thanks Hantsy, I'll take a look. A couple of off the bat observations:

* The @Transactional, as you have demonstrated, is completely redundant in this case. That would actually check for a transaction three times. You're in an EJB so there's already a transaction provided by the container. If that doesn't work, Seam Faces with Seam Transaction will create a transaction at the start of the request. Then of course the @Transactional interceptor would create a transaction if that didn't work. So this is very redundant as you can see.
* My initial thought because the transaction has nothing to do with the saving as you are certainly within a transaction is your EntityManager for some reason is in the manual flush mode from Hibernate. I'll have to look and see if that's actually the case. As in the first two methods there's no flush and it doesn't appear the EntityManager is being flushed at the end of the transaction or at the end of the method as one would think.

When you get the exception, which method are you invoking, does it matter?
> LazyInitializationException threw when persist a Many to Many collection of an entity.
> --------------------------------------------------------------------------------------
>                 Key: SEAMPERSIST-67
>                 URL: https://issues.jboss.org/browse/SEAMPERSIST-67
>             Project: Seam Persistence
>          Issue Type: Bug
>         Environment: Java 6 update 27, Seam 3.1.0Beta2, JBoss 7.0.1.Final
>            Reporter: hantsy bai
>            Priority: Critical
> I tried a saved a many to many relation(multicheckbox), but failed.
> But in before seam 2 application, I used like this, never encounter such a problem.
> I used Seam managed Persistence, and added TransactionIntercepter in the beans.xml.
> Please refer the discussion in the forum.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list