I've used CMP and BLOBs with JBoss in the past. Declare the bean member variable that
will hold your BLOB data as a byte[]. This will get mapped to the <jdbc-type> of
JAVA_OBJECT. Then check (standard)jaws.xml to see that the mapping for this exists.
It looks like the mapping below - BLOB(2000) - was taken from the DB2 section of
standardjaws.xml. DB2 does not seem to have an arbitrary-sized BLOB type, you have to
declare a maximum size for a BLOB in advance. You might want to keep this in mind
when choosing a database. Postgres has a BLOB type of "unlimited" size.
My experience doing BLOB inserts with Postgres and DB2 and with JBoss is that it's
horribly slow. I believe the database is the problem - DB2 was maybe 25% faster than
Postgres but neither was fast enough for high-volume inserts, and this was with fairly
small BLOBs - 10k-20k. It's possible that the overall problem was not caused by the
databases but by JAWS and/or RMI overhead.
One thing I'd like to figure out is how to do these BLOB operations while minimizing
memory use at both the client and the server. To make BLOBs work with CMP I've had to
buffer the blob in memory as a byte[] member variable, both at the client and in the
bean instance. Is there a more efficient way to achieve the same thing? It would be
wonderful if you could declare an InputStream member and have the RMI serialization
code read from this at the client w/o a lot of in-memory buffering. I know that some
JDBC drivers can handle InputStream parameters on PreparedStatements, but JAWS doesn't
seem to support this.
Regards,
Eric
>Message: 8
>Date: Sat, 14 Jul 2001 03:04:25 -0700 (PDT)
>From: Jason Dillon <[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]>
>Subject: Re: [JBoss-user] BLOB
>Reply-To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>It looks like JAWS can persist objects via BLOB... but that is just a simple
>guess by looking at the standardjaws.xml, it has some lines that look like
>this:
> <mapping>
> <java-type>java.lang.Object</java-type>
> <jdbc-type>JAVA_OBJECT</jdbc-type>
> <sql-type>BLOB(2000)</sql-type>
> </mapping>
>Which would lead me to believe that you could get JAWS to persist to a record
>with a BLOB column. I would try it.
>--jason
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user