Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQLException in ejbCreate()

2 views
Skip to first unread message

amit modak

unread,
May 13, 2002, 10:07:32 AM5/13/02
to
hello friends,

I'm trying to create an Entity Bean using CMP 2.0 in Weblogic 7. Using
MS SQL Server 7 with the type 4 mssqlserver jdbc driver that is part
of type 4 mssqlserverweblogic.jar.

findByPrimaryKey() works fine.
It's only ejbCreate() that's failing with the exception pasted below.

I tried setting Transcation to both Required and NotSupported.
Concurrency level is Database.

I'd be very grateful if some one could help me out of this situation.

"CECLIENT1" happens to be the name of the box where ms sql server 7 is
running.

<EJB Exception in method: ejbPostCreate: java.sql.SQLException: Line
6: Incorrect syntax near ')'. Severity 15, State 1, Procedure
'CECLIENT7 null', Line 6>
java.sql.SQLException: Line 6: Incorrect syntax near ')'. Severity 15,
State 1, Procedure 'CECLIENT7 null', Line 6
at weblogic.jdbc.mssqlserver4.TdsStatement.processWarning(TdsStatement.java:1231)
at weblogic.jdbc.mssqlserver4.TdsStatement.parseMsWarning(TdsStatement.java:1142)
at weblogic.jdbc.mssqlserver4.TdsStatement.getMoreResults(TdsStatement.java:800)
at weblogic.jdbc.mssqlserver4.TdsStatement.execute(TdsStatement.java:216)
at weblogic.jdbc.mssqlserver4.TdsStatement.executeUpdate(TdsStatement.java:99)
at weblogic.jdbc.mssqlserver4.TdsStatement.executeUpdate(TdsStatement.java:1518)
at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:294)
at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:68)
at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:58)
at com.scit.pfp.ejb.asset.MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.__WL_create(MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.java:1156)
at com.scit.pfp.ejb.asset.MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.ejbPostCreate(MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.java:1070)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.ejb20.manager.DBManager.create(DBManager.java:756)
at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:696)
at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:201)
at com.scit.pfp.ejb.asset.MacroAssetBean_gosheh_HomeImpl.create(MacroAssetBean_gosheh_HomeImpl.java:76)
at com.scit.pfp.ejb.asset.MacroAssetBean_gosheh_HomeImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:342)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:103)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:313)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:156)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:137)
>

Thanks in advance.
Amit

thorick

unread,
May 13, 2002, 10:08:46 PM5/13/02
to
can you compile the MacroAssetBean with the ejbc -keepgenerated flag set, then
post the SQL command that is generated in the file:

MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.java

in the routine WL_create() ?

thanks

-thorick

amit modak

unread,
May 14, 2002, 4:06:21 AM5/14/02
to

hello thorick ,

as per your request, i'm sending this section of generated
SQL from MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.java

__WL_query_array[0] = "INSERT INTO ASSETTEMP (ASSET_ID, EXPECTED_RETURN, NAME,
VOLATILITY) VALUES (?, ?, ?, ?)";

The column ASSET_ID is the PK with clustered index and is an Identity column in the
db.
I've configured weblogic 7 properly to use SQL_SERVER identities.

I personally see nothing wrong with this SQL. Could it be a
problem in the mssqlserver4 driver in weblogic.jar while
converting this SQL to native SQL format ?

Eagerly waiting for your response.

Thanks in advance.
amit

amit modak

unread,
May 14, 2002, 4:17:56 AM5/14/02
to

hello thorick,

As per your request, i'm sending this section of generated
SQL in MacroAssetBean_gosheh__WebLogic_CMP_RDBMS.java

thorick

unread,
May 14, 2002, 10:12:22 PM5/14/02
to
Ah ha !

If ASSET_ID is an IDENTITY column then it cannot be listed in the INSERT statement.
I think the best course of action is to declare that the Bean is using
automatic-key-generation via the following declaration in the cmp dd:

<automatic-key-generation>
<generator-type>SQL_SERVER</generator-type>
</automatic-key-generation>

The generated INSERT should then NOT have the ASSET_ID listed in the INSERT statement
and the container will get the PK value from the DB after the INSERT.

hope this helps.

=thorick


amit modak

unread,
May 15, 2002, 2:03:56 AM5/15/02
to

your statement makes perfect sense but i'm ALREADY using automatic-key generation.

i have the following entry in weblogic-cmp-rdbms-jar.xml

<automatic-key-generation>
<generator-type>SQL_SERVER<generator-type>
<generator-name>IDENTITY</generator-name>
<key-cache-size>10</key-cache-size>
</automatic-key-generation>

it seems that ejbc is still generating the SQL in MacroAssetBean_goseh_Weblogic_CMP_RDBMS.java
with



"INSERT INTO ASSETTEMP (ASSET_ID, EXPECTED_RETURN, NAME, VOLATILITY) VALUES (?, ?,
?, ?)";

instead of

"INSERT INTO ASSETTEMP (EXPECTED_RETURN, NAME, VOLATILITY) VALUES (?, ?, ?)";

pls suggest what to do.

thanks in advance
Amit


thorick

unread,
May 15, 2002, 6:13:46 PM5/15/02
to
I see. What version of WLS is this showing up on ?

-thorick

Michael Jouravlev

unread,
May 15, 2002, 6:26:08 PM5/15/02
to
"amit modak" <amit...@rediffmail.com> wrote in message
news:3ce1fa4c$1...@newsgroups2.bea.com...

> i have the following entry in weblogic-cmp-rdbms-jar.xml
>
> <automatic-key-generation>
> <generator-type>SQL_SERVER<generator-type>
> <generator-name>IDENTITY</generator-name>
> <key-cache-size>10</key-cache-size>
> </automatic-key-generation>

Do you also have have something like

<entity>
...
<primkey-field>assetId</primkey-field>
</entity>

in your ejb-jar.xml ? Just in case...
We use autogenerated PKs on WL6.1SP2 + Sybase Adaptive Server, and it works.

Michael Jouravlev.


amit modak

unread,
May 16, 2002, 1:10:25 AM5/16/02
to

>What version of WLS is this showing up on ?

i'm using WLS 7 beta with ms-sql server 7.

in case this might help (from jdbc log): SQLException: SQLState(01000) vendor code(170)


thanks in advance
amit

amit modak

unread,
May 16, 2002, 1:04:31 AM5/16/02
to

">Do you also have have something like
><entity>
> ...
> <primkey-field>assetId</primkey-field>
></entity>
>
>in your ejb-jar.xml ?

yes,i do have the following lines in ejb-jar.xml

<prim-key-class>java.lang.Integer</prim-key-class>
....
<cmp-version>2.x</cmp-version>
...
<cmp-field>
<field-name>assetID</field-name>
</cmp-field>
...
<primkey-field>assetID</primkey-field>

i'm using WLS 7 beta with ms-sql server 7.

in case this might help (from jdbc log):
SQLException: SQLState(01000) vendor code(170)

thanks in advance
Amit

thorick

unread,
May 16, 2002, 3:25:23 PM5/16/02
to
WLS7 Beta. This might have been fixed in WLS7 GA.
Would it be possible to download the GA version and
give a quick recompile ?

-thorick


amit modak

unread,
May 17, 2002, 10:45:34 AM5/17/02
to

>WLS7 Beta. This might have been fixed in WLS7 GA.
>Would it be possible to download the GA version and
>give a quick recompile ?

well i have started downlaoding WLS7 GA over a dial-up line in India where speeds
r painstakingly slow.
hope the problem is fixed with GA.
the WLS 7 download page has windows 2000. but we have NT sp6. hope that doesn't create
a new set of problems. now i can't upgrade the OS(not yet)
i'll get back with the outcome in a day.

thankx
amit

amit modak

unread,
May 24, 2002, 12:06:20 PM5/24/02
to

>WLS7 Beta. This might have been fixed in WLS7 GA.
>Would it be possible to download the GA version and give a >
>quick recompile ?

Thankxx a lot for your advice Thorick.
i problem did not occur with WL7 GA. i guess the problem was with the WL 7 beta generated
SQL.

thankx again
amit

0 new messages