On Monday, June 10, 2002, at 05:03 PM, Bruce Snyder wrote:
> This one time, at band camp, pixelandink.com said:
>
> p>
> p>I've mapped a field in one of my classes's fields to a BLOB colum in
> p>MySQL, following the example in the JDO types documentation.
> p>
> p> <field name="dataS" type="stream" >
> p> <sql name="data" type="blob" dirty="ignore"/>
> p> </field>
> p>
> p>I've had no trouble putting data into reocrds from my objects via a
> p>getter method in my class, but I can't get data back out of MySQL
> with a
> p>setter method. It's not clear to me from the docs what type the
> argument
> p>to the set method for the field in my class should be. I tried the
> p>"natural" type...
> p>
> p>public void setDataS(InputStream s)
> p>
> p>When called by Castor, s is null.
>
> David,
>
> I'm confused as to which operation actually works. An accessor
> method (the getter) is used to fetch data from the database and the
> mutator method (the setter) is used to assign data to objects which
The getter and setter methods access values in an object, not values in
the database directly. Put breakpoints in the get and set methods for a
mapped field in a persistent class and watch what happens when you do do
db.create(), db.update() or iterate through the results of an oql query.
Castor calls the getters during create() and update() and the setters
when building a java object (in memory) from database records.
My problem was (It works now--a stupid, late-night mistake) that Castor
was calling the set method with null when iterating through a
query--when trying to build objects in memory from the database.
> eventually put the data into the database. At any rate, I would
> recommend that you take a look at the tests in src/tests/jdo to see
> how they handle BLOBs.
>
> Bruce
> --
>
> perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-
> O;0\`\`");'
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev