Thanks fir the heads up, but I don't think that's it. I'm only shoving strings, Dates and URLs in there ATM, and none of them come close the 64K limit. Also, manually deserializing them works without problems.
I've gone back to using Strings and being a bit more careful with how I manipulate the data. Pity. On Thu, 2002-05-16 at 01:22, James Higginbotham wrote: > I have seen this one on mySQL - maybe some of it will translate. > Basically, if you are letting Jboss create the tables if they don't > exist, it will create the row as a BLOB. In mySQL, BLOB is limited to > 64k, so you really need a LONGBLOB. If the serialized byte stream gets > cut off, the built in unmarshal logic will not be able to handle the > incomplete serialization and will pass it to the application as a byte > array. Be sure your column has the right SQL type to accommodate your > size needs. And, if Jboss is creating the table with the wrong sized > column type in Postgres, then create the table manually and tell JB not > to create or remove the tables within the jbosscmp-jdbc.xml file. > > Here is my jbosscmp-jdbc.xml and table structure that works in JB 3.0: > > <jbosscmp-jdbc> > <defaults> > <datasource>java:/myDatasource</datasource> > <datasource-mapping>mySQL</datasource-mapping> > <create-table>false</create-table> > <remove-table>false</remove-table> > <pk-constraint>false</pk-constraint> > </defaults> > > <enterprise-beans> > <entity> > <ejb-name>WorkflowStorageBean</ejb-name> > <table-name>workflowejb</table-name> > <cmp-field> > <field-name>workflowId</field-name> > <column-name>workflowId</column-name> > <jdbc-type>VARCHAR</jdbc-type> > <sql-type>VARCHAR(64)</sql-type> > > </cmp-field> > <cmp-field> > <field-name>data</field-name> > <column-name>data</column-name> > <jdbc-type>JAVA_OBJECT</jdbc-type> > <sql-type>BLOB</sql-type> > </cmp-field> > </entity> > </enterprise-beans> > </jbosscmp-jdbc> > > > CREATE TABLE workflowejb ( > workflowId varchar(64) NOT NULL default '', > data longblob > ) TYPE=InnoDB; > > HTH, > James > > > -----Original Message----- > > From: Simon Stewart [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, May 15, 2002 5:12 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-user] Deserializing objects to DB > > > > > > On Wed, 2002-05-15 at 20:06, Simon Stewart wrote: > > > I have a simple EJB that has three fields ("ID", a "key" and a > > > "value") Key is a string, and value is given as being of class > > > java.io.Serializable, so this class represents a basic > > key/value pair. > > > Data appears to be serialized to the database okay (Postgres 7.2.1, > > > column type BYTEA) but as a byte array. (I'll paste it below so > > > someone can correct me when they want to) > > > > > > On deserializing the data, I get ClassCastErrors. The class being > > > recovered from the DB is "[B" according to the exception > > being thrown, > > > and that's just plain wrong. Anyone else seen this or got > > any ideas? A > > > > > > deserializedObject.getClass().getName() > > > > > > also returns "[B". More poking about reveals that this is a byte > > > array. Is it a quirk of my JDBC driver that this happens, > > or is this > > > something to do with JBoss' handling of serialzied objects > > in EJBs? I > > > can post code, should people need it. > > > > > > Currently using Postgres 7.2.1, JDK 1.4 (from Sun), JBoss 3RC2, the > > > usual suspects :) > > > > I'm starting to suspect that JBoss might be the culprit here. > > If I manually extract an object from the byte array, it turns > > out to be a java.rmi.MarshalledObject when the expected class > > was java.lang.String. > > > > Can anyone shed some light on this? I'm using CMP 2, if that helps. > > > > Regards, > > > > Simon > > > > > > _______________________________________________________________ > > > > Have big pipes? SourceForge.net is looking for download > > mirrors. We supply the hardware. You get the recognition. > > Email Us: [EMAIL PROTECTED] > > _______________________________________________ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/j> boss-user > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user