users@glassfish.java.net

Re: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFa

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 23 Jul 2009 15:18:17 -0700

Can you post persistence.xml? Did you start Derby database?

thanks,
-marina

glassfish_at_javadesktop.org wrote:
> I found some old post about the PersistenceUnit at http://forums.sun.com/thread.jspa?threadID=760506 and stating:
>
> "I'm not 100% sure that this is the correct solution, but it works for me. I modified the em field in the com.sun.bookstore6.backing.AbstractBean class to no longer be static. My code now looks like:
>
> @PersistenceContext(name = "books")
> private EntityManager em;
>
> The reason that I did this was that I found the code that generated the exception and saw that it was doing a modifier check on the field before doing the injection. If an object instance was supplied to the injection code, the field being injected could not be static."
>
> So what I tried is annotate the EntityManager in the BookDBAO class:
>
> public class BookDBAO {
> private ArrayList books;
> @PersistenceContext(name = "books")
> private EntityManager em;
>
> But this is also not working. I have also tried some poking into the dark and tried to use another name for "books" and tried "jdbc/BookDB" "DerbyPool" but this is also not working. Any idea?
>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357317
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>