0 Replies Latest reply on Nov 29, 2008 6:47 PM by pedrosena

    Problems with AOP + Seam + Hibernate

    pedrosena

      Hi Guys,


      I'm making some experiences right here and I would like some help.


      I'm trying to inject my repositories inside my entity classes.


      I know that Seam does not manage my entity classe because JPA already to this, so I created an aspect that intercepts the instanciation of my entity classe and then inject the correct repository in that entity.


      But when I run some tests, I'm getting:


      org.hibernate.InstantiationException: could not instantiate test object br.com.netsar.model.entity.NetSarCustomer



      caused by:


      No application context active



      I believe that is something related to the way that hibernate load my entities, most exactly, WHEN it does it, I believe that hibernate is creating my entity classes before Seam gets started.


      Is there some way to start my Seam environment before hibernate load my classes ?


      PS: I know that some of you guys don't agree with this approach and would like to avoid any kind of discussion about the approach in this thread, if you want to discuss it we can do this in another topic.


      Thanks in advance,


      Pedro Sena