-
1. Re: Specified key was too long
cpairot Aug 29, 2002 12:29 PM (in response to cpairot)I have found that if I change the property:
<java-type>java.lang.String</java-type>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(250) BINARY</sql-type>
from standardjbosscmp-jdbc.xml it works but this affects all string mappings that JBoss does. Is it possible to make this mapping at field method ? -
2. Re: Specified key was too long
cpairot Aug 30, 2002 5:52 AM (in response to cpairot)Hi,
For those of you who are interested in this topic, I have found a better solution: I have added my own database type mapping to jbosscmp-jdbc.xml specific file of my application. Now all java strings are mapped to Varchar(250) but this only affects my application instead of affecting all applications by modifying the standardjbosscmp-jdbc.xml file.
Greetings,
Carles. -
3. Re: Specified key was too long
cpairot Aug 30, 2002 9:08 AM (in response to cpairot)Hi again,
I am trying to map the primary key variable to a specific JDBC type and I am trying to do so by putting these lines within jbosscmp-jdbc.xml:
...
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
<sql-type>VARCHAR(100)</sql-type>
</cmp-field>
...
But when I deploy the entity bean, JBoss displays this error:
14:11:44,707 ERROR [XmlFileLoader] File file:/C:/cygwin/home/pairot/jboss3/serve
r/default/tmp/deploy/server/default/deploy/botule-ejb-test.jar/80.botule-ejb-tes
t.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 107. Error message:
org.xml.sax.SAXParseException: The element "cmp-field" does not accept "sql-type" here.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(
ValidatingParser.java:349)
Isn't this the correct syntax or I am missing something? The jbosscmp-jdbc.xml file is automatically generated by XDoclet 1.2.
Thanks in advance,
Carles. -
4. Re: Specified key was too long
cpairot Aug 30, 2002 9:09 AM (in response to cpairot)Hi again,
I am trying to map the primary key variable to a specific JDBC type and I am trying to do so by putting these lines within jbosscmp-jdbc.xml:
...
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
<sql-type>VARCHAR(100)</sql-type>
</cmp-field>
...
But when I deploy the entity bean, JBoss displays this error:
14:11:44,707 ERROR [XmlFileLoader] File file:/C:/cygwin/home/pairot/jboss3/serve
r/default/tmp/deploy/server/default/deploy/botule-ejb-test.jar/80.botule-ejb-tes
t.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 107. Error message:
org.xml.sax.SAXParseException: The element "cmp-field" does not accept "sql-type" here.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(
ValidatingParser.java:349)
Isn't this the correct syntax or I am missing something? The jbosscmp-jdbc.xml file is automatically generated by XDoclet 1.2.
Thanks in advance,
Carles. -
5. Re: Specified key was too long
cpairot Aug 30, 2002 9:12 AM (in response to cpairot)Hi again,
I am trying to map the primary key variable to a specific JDBC type and I am trying to do so by putting these lines within jbosscmp-jdbc.xml:
...
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
<sql-type>VARCHAR(100)</sql-type>
</cmp-field>
...
But when I deploy the entity bean, JBoss displays this error:
14:11:44,707 ERROR [XmlFileLoader] File file:/C:/cygwin/home/pairot/jboss3/serve
r/default/tmp/deploy/server/default/deploy/botule-ejb-test.jar/80.botule-ejb-tes
t.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 107. Error message:
org.xml.sax.SAXParseException: The element "cmp-field" does not accept "sql-type" here.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(
ValidatingParser.java:349)
Isn't this the correct syntax or I am missing something? The jbosscmp-jdbc.xml file is automatically generated by XDoclet 1.2.
Thanks in advance,
Carles. -
6. Re: Specified key was too long
cpairot Aug 30, 2002 9:44 AM (in response to cpairot)As usual, I answer myself again. Final solution:
...
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(100)</sql-type>
</cmp-field>
...
And it works perfectly.
Cheers,
Carles.