Hi,
I am using (My)Eclipse, XDoclet and MySQL for developing my EJBs.
I have an entity bean whose corresponding table requires to be created in the database. All my compiles and deployment goes through fine - but MySQL throws an error complaining the max column size for a VARCHAR field is 256.
My jbosscmp-jdbc.xml shows correct details :
<entity>
<ejb-name>Composer</ejb-name>
<table-name>Composer</table-name>
<cmp-field>
<field-name>composerName</field-name>
<column-name>composerName</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>varchar(50)</sql-type>
</cmp-field>
<cmp-field>
<field-name>genre</field-name>
<column-name>genre</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>varchar(60)</sql-type>
</cmp-field>
<!-- jboss 3.2 features -->
<!-- optimistic locking does not express the exclusions needed -->
</entity>
The errror thrown is :
:36:19,596 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=Composer,service=EJB
MBeanException: org.jboss.deployment.DeploymentException: Error while creating table Composer; - nested throwable: (java.sql.SQLException: Syntax error or access violation message from server: "Too big column length for column 'composerName' (max = 255). Use BLOB instead")
Cause: org.jboss.deployment.DeploymentException: Error while creating table Composer; - nested throwable: (java.sql.SQLException: Syntax error or access violation message from server: "Too big column length for column 'composerName' (max = 255). Use BLOB instead")
From the JBoss log :
2004-08-26 15:36:19,507 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Composer] Executing SQL: CREATE TABLE Composer (composerName VARCHAR(256), definitiveFilm VARCHAR(256), CONSTRAINT pk_Composer PRIMARY KEY ())
Why is it trying to create a table with column size varchar(256) when it has been specified to be much lower ?
I attempted a number of XDoclet tag changes and manipulations but none worked. Any inputs on this ?
Thanks