Hi, I'm a developer from New York. New to OJB, love it so far, first post to
this list ... yadda yadda yadda.

I have a question about inserting Blobs into Mysql. i've tried to follow
protocol and search the mailing list archives, but they seem to be down.

The simple example is this:

1) Table:

id INT(5)
description BLOB

2) repository_user.xml entry:

<class-descriptor class="com.test.businessobjects.TestBO" table="mytable">
<field-descriptor id="1" name="id" column="id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor id="2" name="description" column="description"
jdbc-type="BLOB"/>
</class-descriptor>

3) TestBO class

        import java.sql.Blob;

        public class TestBO {
    
                private Integer id;
                private Blob description;

                // ... "id" getter/setter here
  
                public void setDescription(Blob description) {
                        this.description = description;
                }
 
                public Blob getDescription() {
                        return description;
                }
        }

The problem is setting the Blob initially. Java 1.4 has a setBytes(byte[]
byteArray) method, but Java 1.3 does not. I'm using a shared Unix box so i
cannot upgrade 1.3->1.4 at this time.

I see in OJB's BlobTest.java files that using the Persistance Broker, the
test BLOB fields have getter/setter methods that are type byte[] and not
java.sql.Blob. Then, simply tx.close is used and it saves correctly? Does
the byte[] -> java.sql.Blob conversion happen internally? HOpefully i'm
asking this correctly.

Thanks in advance.

John Reynolds

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to