quality@glassfish.java.net

Re: [Issue 5836] [entity-persistence] Sequence isn't created which leads to exception

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Wed, 03 Sep 2008 14:09:28 -0700

Sherry Shen wrote:
> Hi Adam,
>
> I searched my server.log again for
> "Caused by: java.sql.SQLSyntaxErrorException: Die Tabelle/Ansicht
> 'SEQUENCE' istnicht vorhanden." or others, but did not find them.
> I do see expected Exceptions as enclosed.
> cc Mitesh who works JPA support.
> Hi Mitesh,
>
> Would you please check when we may see the error Adam reported?
> Is it possible to reduce the stacktrace for expected Exceptions
> so that we can find the real problem easily?
>
Thats a known issue. EclipseLink currently spits out a stack trace when
it encounters a SQLException (like DROP table on not existing table)
during java2db.
> Thanks!
>
> Sherry
> PS: % grep SQLSyntaxErrorException server.log
> % grep SQLException server.log
> Internal Exception: java.sql.SQLException: 'DROP TABLE' cannot be
> performed on 'BOOK' because it does not exist.
> .......
> Internal Exception: java.sql.SQLException: Table/View 'SEQUENCE'
> already exists in Schema 'DBUSER'.
Adam,
This confirms that table SEQUENCE is created in your environment. I am
confused about issue 5836. Why do you say the table is not being
created? Based on above and Sherry's testing, I am marking the bug as
"Works for me". Please reopen if you have additional info.

Thanks,
Mitesh
>
> They are due to no BOOK table doesn't exist in the initial run
> or due to an existing SEQUENCE in previous run.
>
>
>
> Adam Bien wrote, On 9/3/2008 8:42 AM:
>
>> Sherryshen,
>>
>> I saw the output too, but a huge stacktrace as well. Futher I didn't
>> found the record in the DB (with DB-explorer)...
>> It seems like the exception was swallowed somehow - therefore the
>> successful output. Could you please re-check it?
>>
>> regards,
>>
>> adam
>> sherryshen_at_dev.java.net schrieb:
>>
>>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=5836
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------- Additional comments from sherryshen_at_dev.java.net Wed Sep 3
>>> 15:35:10 +0000 2008 -------
>>> I saw that attached example works fine.
>>> --v3 b22 promoted + ejb from Update Center.
>>> --deploy app, "asadmin deploy LeanestCrud.war"
>>> --access URI, /LeanestCrud/BookManagementView
>>> --see "Book created!" on browser.
>>> --modified persistence.xml with more logging message.
>>> <property name="eclipselink.logging.level" value="FINE"/>
>>> --restart server
>>> --access URI again,
>>> --see "Book created!" on browser and server.log about SEQ and BOOK.
>>>
>>> [#|2008-09-03T08:25:14.990-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|DELETE
>>>
>>> FROM SEQUENCE WHERE SEQ_NAME = SEQ_GEN|#]
>>>
>>> [#|2008-09-03T08:25:15.036-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|SELECT
>>>
>>> * FROM SEQUENCE WHERE SEQ_NAME = SEQ_GEN|#]
>>>
>>> [#|2008-09-03T08:25:15.064-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|INSERT
>>>
>>> INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values (SEQ_GEN, 0)|#]
>>>
>>> [#|2008-09-03T08:25:15.171-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|UPDATE
>>>
>>> SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
>>> bind => [50, SEQ_GEN]|#]
>>>
>>> [#|2008-09-03T08:25:15.218-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|SELECT
>>>
>>> SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?
>>> bind => [SEQ_GEN]|#]
>>>
>>> [#|2008-09-03T08:25:15.277-0700|FINE||org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/LeanestCrud/WEB-INF/classes/-book.sql|_ThreadID=16;_ThreadName=Thread-4;ClassName=null;MethodName=null;|INSERT
>>>
>>> INTO BOOK (ID, NAME) VALUES (?, ?)
>>> bind => [1, Productive Java EE]|#]
>>>
>>>
>>>
>>
>>
>>
>