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 16:21:06 -0700

glassfish_at_javadesktop.org wrote:
> Okay. I found the problem. I have manually created the bookstore.jar without adding the src/META-INF/persistence.xml
>
> The easiest way is using Ant to create the jar files like:
> 1. Open the command prompt
> 2. go to glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1>
> 3. Enter "ant"
> 4. copy the bookstore.jar to the eclipse project "bookstore1" from glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore\dist
> 5. Start Glassfish in Eclipse
> 6. Deploy bookstore1
> 7. Open the link http://localhost:8080/bookstore1/bookstore
>
> Now I get this:
> Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20090424-r4050): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.
> Error Code: -1
> Call: SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
> bind => [203]
> Query: ReadObjectQuery(referenceClass=Book sql="SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)")
>
> Before I have properly started "ant create-tables" and all 181 SQLs (tutorial.sql copied from the JEE5 since in JEE6 it is incomplete) has been executed.
>
> @Marina
> In the post http://forums.java.net/jive/thread.jspa?messageID=356461&tstart=0
> you have mentioned:
> "...to change the persistence.xml to set the EclipseLink property:
> "eclipselink.ddl-generation" either to "drop-and-create-tables" or to
> "create-tables".
>
> If the steps included loading DDL, you missed that step.
>
> The latest V3 builds have support for automatic table creation requested via
> asadmin deploy command options."
>
> So this is not necessary to change anymore or should I change the persitence.xml?

It might be that "ant create-tables" creates tables not in the same database as
the persitence.xml points to...

Regards,
-marina

>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357327
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>