Here is the cause and solution:
I use Eclipse/Lomboz as an IDE. The EJBWizard (in the case of CMP beans) takes VARCHAR as the SQL type, not VARCHAR(xy). It complains for VARCHAR(xy). The XDoclet tag generated then only specifies VARCHAR as the SQL type. In the generated JBossCMPJDBC.xml only VARCHAR appears as the SQL type in the 3.1 version of Eclipse. In 2.1 there was not even a <sql-type> tag, unluess I wanted it to be TEXT.
MySQL demands VARCHAR(xy). I've tried it on the command line with SQL.
After adding the (xy) to every appearance of VARCHAR as the SQL type (not the JDBC type - that is left as it is) the tables were created with no problems.
So, obviously JBoss-3.2.0 filled in (255) where no value was supplied for (xy) and JBoss-4.0.0 does not, which makes MySQL unhappy.
I wonder how many additional problems there are going to be - what about relationships, for starters. Is it worth the bother? Should I not stick with JBoss-3.2.0 and Eclipse/Lomboz 2.1? At least they worked.
Look at your create statement:
create table principal_tbl(
username VARCHAR, NOT NULL,
You have a comma between VARCHAR and NOT NULL.