users@glassfish.java.net

Re: Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'WEB_BOOKS

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Mon, 04 May 2009 22:03:03 +0200

glassfish_at_javadesktop.org wrote:
> I am using GlassFish v2.1, NetBeans 6.5.1 on windows xp pro. attempting to follow the Java EE tutorial 5.
>
> I received the following error message after deploying bookstore1:
>
> Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.
> Error Code: -1
> Call: SELECT BOOKID, PRICE, DESCRIPTION, FIRSTNAME, TITLE, CALENDAR_YEAR, SURNAME, INVENTORY, ONSALE FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
> bind => [203]
> Query: ReadObjectQuery(com.sun.bookstore.database.Book)
>

Toplink can create the database schema for you. The relevant property to
add to your persistence.xml is "toplink.ddl-generation". Possible values
to create tables are either "create-tables" or "drop-and-create-tables".

All possible properties are listed here:
http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html#Java2DBSchemaGen

There is also a nice blog entry about this:
http://blogs.sun.com/java2dbInGlassFish/entry/automatic_table_generation_feature_in

BTW: EclipseLink is the successor to TopLink and has nothing to do with
Eclipse (the ide) but with the Eclipse Foundation as maintainer of the
code. You can use it no matter which IDE you use.


--
Wolfram Rittmeyer