You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by th...@apache.org on 2003/04/18 13:20:38 UTC
cvs commit: db-ojb/xdocs faq.xml
thma 2003/04/18 04:20:38
Modified: xdocs faq.xml
Log:
add entry for how to map a list of strings
Revision Changes Path
1.16 +28 -0 db-ojb/xdocs/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/db-ojb/xdocs/faq.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- faq.xml 5 Mar 2003 21:22:08 -0000 1.15
+++ faq.xml 18 Apr 2003 11:20:38 -0000 1.16
@@ -64,6 +64,7 @@
<li><a href="#29">Per thread metadata changes at runtime?</a></li>
<li><a href="#30">Is it possible to use OJB within EJB's?</a></li>
<li><a href="#36">Can OJB handle ternary (or higher) associations?</a></li>
+ <li><a href="#How to map a list of Strings">How to map a list of Strings</a></li>
</ul>
@@ -1101,6 +1102,33 @@
</subsection>
+ <subsection name="How to map a list of Strings">
+ You can not map a list of Strings with a collection descriptor. A collection
+ descriptor can only be used if the element class is a persistent class too.
+ But element-class-ref="java.lang.String" won't work, because it's no
+ persistent entity class!
+ <br/>
+ Follow these steps to provide a mapping for an attribute holding alist of Strings.
+ Let's assume your persistent class has an attribute <code>listOfStrings</code>
+ holding a list of Strings:
+<source><![CDATA[
+protected Collection listOfStrings;
+]]></source>
+
+ The database table mapped to the persistent class has a colum <code>LIST_OF_STRINGS</code> of type
+ <code>VARCHAR</code> that is used to hold all strings.
+
+<source><![CDATA[
+<field-descriptor
+ name="listOfStrings"
+ column="LIST_OF_STRINGS"
+ jdbc-type="VARCHAR"
+ conversion="o.a.ojb.broker.accesslayer.conversions.StringVector2VarcharFieldConversion"
+/>
+]]></source>
+
+
+ </subsection>
</section>