Hi all,
I'm at my wit's end here. I'm trying to deploy my first CMP entity bean using JBoss and MySQL and I keep getting this error message when deploying the EJB jar:
<code>
Caused by: java.sql.SQLException: Syntax error or access violation, message fro
m server: "You have an error in your SQL syntax. Check the manual that correspo
nds to your MySQL server version for the right syntax to use near 'User (uid INT
EGER NOT NULL, fullname VARCHAR(250) BINARY NOT NU"
</code>
The definition for my CMP bean looks like (from jbosscmp-jdbc.xml):
<code>
<entity>
<ejb-name>User</ejb-name>
<table-name>User</table-name>
<cmp-field>
<field-name>uid</field-name>
<column-name>uid</column-name>
<not-null/>
</cmp-field>
<cmp-field>
<field-name>fullname</field-name> <column-name>fullname</column-name>
<not-null/>
</cmp-field>
<cmp-field>
<field-name>username</field-name>
<column-name>username</column-name> <not-null/>
</cmp-field>
<cmp-field>
<field-name>password</field-name>
<column-name>password</column-name>
<not-null/>
</cmp-field>
</entity>
</code>
Any idea what I'm doing wrong to make the SQL get messed up?
-
CMP entity bean + JBoss + MySQL = error! Help! (5 messages)
- Posted by: Joe Attardi
- Posted on: May 17 2004 00:10 EDT
Threaded Messages (5)
- CMP entity bean + JBoss + MySQL = error! Help! by Yoandy Rodriguez on May 17 2004 12:43 EDT
- CMP entity bean + JBoss + MySQL = error! Help! by Joe Attardi on May 17 2004 14:12 EDT
-
CMP entity bean + JBoss + MySQL = error! Help! by marcello mazzoni on July 28 2004 03:24 EDT
- CMP entity bean + JBoss + MySQL = error! Help! by Chris Hart on January 16 2005 04:12 EST
-
CMP entity bean + JBoss + MySQL = error! Help! by marcello mazzoni on July 28 2004 03:24 EDT
- CMP entity bean + JBoss + MySQL = error! Help! by Joe Attardi on May 17 2004 14:12 EDT
- Problem solved! by Joe Attardi on May 18 2004 09:19 EDT
-
CMP entity bean + JBoss + MySQL = error! Help![ Go to top ]
- Posted by: Yoandy Rodriguez
- Posted on: May 17 2004 12:43 EDT
- in response to Joe Attardi
As long as I can see there's nothing bad with your deployment descriptor, maybe you should look into your DataSources definitions. -
CMP entity bean + JBoss + MySQL = error! Help![ Go to top ]
- Posted by: Joe Attardi
- Posted on: May 17 2004 14:12 EDT
- in response to Yoandy Rodriguez
As long as I can see there's nothing bad with your deployment descriptor, maybe you should look into your DataSources definitions.
Hi Yoandy,
Thanks for your reply. I don't see how it could be my DataSource definition since it is talking to the MySQL server successfully. I will try to log the SQL statements so I can see the SQL the CMP is trying to execute, maybe we can see it more clearly then.
Thanks,
Joe -
CMP entity bean + JBoss + MySQL = error! Help![ Go to top ]
- Posted by: marcello mazzoni
- Posted on: July 28 2004 03:24 EDT
- in response to Joe Attardi
I have a similar problem, since I get a meaningless message from JBOSS (a syntax error near ) on the query) during the creation of table, can you explain how you log the query made by JBOSS on mysql.
thanks -
CMP entity bean + JBoss + MySQL = error! Help![ Go to top ]
- Posted by: Chris Hart
- Posted on: January 16 2005 16:12 EST
- in response to marcello mazzoni
I'm not sure how to do this in JBoss, but you can turn on logging in MySQL when you start the server: mysqld_safe --log. All statements will be logged to a file in the data directory. -
Problem solved![ Go to top ]
- Posted by: Joe Attardi
- Posted on: May 18 2004 09:19 EDT
- in response to Joe Attardi
For anyone who was interested, I found the problem. Actually there were two problems.
1) The name of the table I assigned to the CMP bean was 'user'. Apparently MySQL doesn't like that since it maintains a 'user' table in the 'mysql' database.
2) In my primary key class (I always make custom primary key classes even if the primary key is just a primitive type), the variable name of the field did not match the field name I specified in the jbosscmp-jdbc.xml file, so when it was creating the primary key constraint it wasn't passing any field name, so one of the parameters was blank. I fixed that and now my bean deployed no problem!
Joe