On 12/07/2010 01:10 PM, farouk korteby wrote:
> Hi,
>

> The string property is limited to 255 chars, you must
> use text-area property.

Sure, but that doesn't explain why:

(1) The string is not truncated to match the limit.
(2) The database ends up in an invalid state (e.g. I can't modify the 
object, I can't recreate the object, I can't modify the class..)

Even if (1) is arguable, (2) shouldn't happen. Are you able to reproduce 
(2)?

Thanks.
Marius

>
> Take look
> at 
> \xwiki-enterprise-jetty-hsqldb-2.0.2\webapps\xwiki\WEB-INF\lib\xwiki-core-xx.jar
>>> xwiki.hbm.xml
> -----------------------------------------------------------------------------------------------------
>   <joined-subclass name="com.xpn.xwiki.objects.StringProperty"
> table="xwikistrings">
>              <key>
>                  <column name="XWS_ID"  />
>                  <column name="XWS_NAME"  />
>              </key>
>              <property name="value" type="string">
>                  <column name="XWS_VALUE" *length="255"* />
>              </property>
>          </joined-subclass>
> -----------------------------------------------------------------------------------------------------
>
>
> 2010/12/7 Marius Dumitru Florea<[email protected]>
>
>> Hi devs,
>>
>> I have a serious problem. I'm using a fresh XE 2.6 with MySql (fresh db
>> + XE 2.6 XAR import) and I'm doing this:
>>
>> 1. Create a class Main.TestClass with only one property (say "city") of
>> type "String".
>> 2. Add an object of type Main.TestClass to Main.TestClass page and set
>> the value of "city" to a large string (say 270 characters).
>> 3. Save.
>>
>> I get:
>>
>> ----------8<----------
>> org.hibernate.exception.DataException: could not insert:
>> [com.xpn.xwiki.objects.StringProperty]
>> ...
>> Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too
>> long for column 'XWS_VALUE' at row 1
>> ---------->8----------
>>
>> IMO "Data too long" should be only a warning. Why isn't the string
>> simply truncated if it's too long?
>>
>> If I go back to the object editor the value of the "city" property is
>> empty. If I try to set the value to a short string, say "Paris" and then
>> save, I get:
>>
>> ----------8<----------
>> Failed to commit or rollback transaction. Root cause []
>> ...
>> Wrapped Exception:
>>
>> org.hibernate.StaleObjectStateException: Row was updated or deleted by
>> another transaction (or unsaved-value mapping was incorrect):
>> [com.xpn.xwiki.objects.StringProperty#<?xml version="1.0"
>> encoding="UTF-8"?>
>>
>> <city>Paris</city>
>> ]
>> ---------->8----------
>>
>> So how can I fix this? If I delete the object and then create a new one,
>> setting the value of "city" to "Rome" I get the same exception as
>> before, but with:
>>
>> <city>Rome</city>
>>
>> Is this related to my configuration?
>>
>> Thanks,
>> Marius
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>
>
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to