Hi Ludovic Thank you for your answer. After discussing it we decided to leave this field unmapped. We map this class since we expect many objects and need to list it in different combinations (e.g. show all where field x=y and p=q) which would lead to lots of joins. We think mapping the DBList to its own subtable would not make much of a difference to not mapping it and the DBList field is not that important for our listings anyway, so we will leave it unmapped for now. If we should run into problems with this field later we will see then how we can solve them. Btw.: Three cheers for the possibility to custom map classes partially. It's not the first time this feature comes in handy :)
Thanks Edo On Wed, Nov 16, 2011 at 6:40 PM, Ludovic Dubost <[email protected]> wrote: > Trying to guess it it could be: > > <list name="nameofyourfield" table="nameofyoursubtable" lazy="false"> > <key> > <column name="XWL_ID" /> > </key> > <index column="XWL_NUMBER"/> > <element column="XWL_VALUE" type="string" /> > </list> > > XWL_ID -> field that represents the id of your objkect > > > 2011/11/16 Ludovic Dubost <[email protected]> > >> A multi select DB list is stored in a sub table. It seems you have used a >> string to store the value but you can't. >> Look at the hbm of XWiki on the way the DBStringListProperty is done >> >> <joined-subclass name="com.xpn.xwiki.objects.DBStringListProperty" >> table="xwikilists"> >> <key> >> <column name="XWL_ID" /> >> <column name="XWL_NAME" /> >> </key> >> <list name="list" table="xwikilistitems" lazy="false"> >> <key> >> <column name="XWL_ID" /> >> <column name="XWL_NAME" /> >> </key> >> <index column="XWL_NUMBER"/> >> <element column="XWL_VALUE" type="string" /> >> </list> >> </joined-subclass> >> >> Now I'm not sure exactly how to do it. I've never tried it. If you make it >> work please tell us. >> >> 2011/11/16 Edo Beutler <[email protected]> >> >>> Hi >>> >>> Today I tried to create a custom mapping for a class. One field of the >>> class is a DBList with the "Multiple Select" option activated. To save >>> the values to the DB I wanted to use a string field like I'm used to >>> with static lists and non multi select DB lists. Now I get the >>> following exception when trying to save a Document with an object >>> attached: "java.util.ArrayList cannot be cast to java.lang.String" >>> >>> How could I custom map a DBList field if String ist not possible? or >>> is there even a simple Solution I missed? >>> >>> A hint in the right direction would be appreciated >>> Edo >>> _______________________________________________ >>> devs mailing list >>> [email protected] >>> http://lists.xwiki.org/mailman/listinfo/devs >>> >> >> >> >> -- >> Ludovic Dubost >> Founder and CEO >> Blog: http://blog.ludovic.org/ >> XWiki: http://www.xwiki.com >> Skype: ldubost GTalk: ldubost >> >> > > > -- > Ludovic Dubost > Founder and CEO > Blog: http://blog.ludovic.org/ > XWiki: http://www.xwiki.com > Skype: ldubost GTalk: ldubost > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

