Preistoria: ricevo l'eccezione JDBCExceptionReporter data exception: string data, right truncation
per l'aggiornamento delle entità.Come impostare la dimensione della colonna di stringhe usando service.xml o Service Builder?
Ho trovato che questo significa che i dati sono troppo grandi per lo varchar
specificato.
Nella service.xml
colonna è specificato come:
<column name="message" type="String"/>
ho trovato nel codice sorgente di Liferay per ServiceBuilder
questo frammento:
else if (colType.equals("String")) {
Map<String, String> hints = ModelHintsUtil.getHints(
_packagePath + ".model." + entity.getName(), colName);
int maxLength = 75;
if (hints != null) {
maxLength = GetterUtil.getInteger(
hints.get("max-length"), maxLength);
}
if (col.isLocalized()) {
maxLength = 4000;
}
if (maxLength < 4000) {
sb.append("VARCHAR(" + maxLength + ")");
}
else if (maxLength == 4000) {
sb.append("STRING");
}
else if (maxLength > 4000) {
sb.append("TEXT");
}
}
Ora la mia domanda è: come posso definire il max-length
per le mie colonne?