deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Maisano <bmais...@andera.com>
Subject RE: LazyInit exception with hibernate integration
Date Thu, 09 May 2013 18:08:43 GMT
FYI we have figured out the issue.   I put below in hibernate post, thanks for the responses.

When we tried to turn on our EntityManagerFactory producer class we were producing entity
manager and entity manager factory. That caused weld duplicate producer exception, so we had
it off thinking seam included this. It turns out we should only produce entity manager factory
not entity manager, which makes sense. Below is working...though it seems weird we need to
add this in our application code at all, and its not build into some seam jar.

@Named
@ApplicationScoped
public class EntityManagerHandler {

@SuppressWarnings("unused")
@ExtensionManaged
@Produces
@PersistenceUnit(unitName="pu1")
@Dependent
private EntityManagerFactory entityManagerFactory;

public void setupEntityManager(
@Observes SeamManagedPersistenceContextCreated event) {

Session session = (Session) event.getEntityManager().getDelegate();
LogManager.info(
EntityManagerHandler.class,
"Seam Managed Persistence COntext created for entity manager:"
+ event.getEntityManager() + "\nsession:"
+ session.toString());

}


-----Original Message-----
From: Christian Beikov [mailto:christian.beikov@gmail.com] 
Sent: Wednesday, May 08, 2013 5:44 PM
To: deltaspike-users@incubator.apache.org
Subject: Re: LazyInit exception with hibernate integration

As written in the forum post this might be related to the scope of the EntityManager which
indeed could have changed when moving away from seam. I would need more insight into your
code to be able to give you a better answer or hint.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 08.05.2013 23:40, schrieb Ben Maisano:
> Thanks Christian.  Well site says seam 3 no longer supported (recent change?) so I thought
this is my best option besides hibernate forum.  Note this was all working, same mappings,
on seam 2.  hibernate.initialize and fetch.eager do solve problem.  The issue is we have a
large dependent entity model and to change everything to fetch.eager is not an option for
us.
>
> -----Original Message-----
> From: Christian Beikov [mailto:christian.beikov@gmail.com]
> Sent: Wednesday, May 08, 2013 5:34 PM
> To: deltaspike-users@incubator.apache.org
> Subject: Re: LazyInit exception with hibernate integration
>
> Answered you in forum, but I don't quite understand what this has to do with deltaspike...
>
> Mit freundlichen Grüßen,
> ----------------------------------------------------------------------
> --
> *Christian Beikov*
> Am 08.05.2013 23:13, schrieb Ben Maisano:
>> Hi DeltaSpike users,
>>                   I am thinking of using deltaspike once it comes out of beta, however
right now we are using seam 3.  I thought this best list to ask about this question besides
hibernate forums.  If anyone can help with ideas for what to look for related to the details
in this post please let me know, thank you.
>>
>> https://forum.hibernate.org/viewtopic.php?f=1&t=1026107
>>
>>
>> Benjamin Maisano
>>


Mime
View raw message