You should try a test program which serializes your object outside HSQLDB to see if you have successfully implemented the requirements of the java.io.Serializable interface. A serializable object should not throw. You can use the following test code:
ByteArrayOutputStream bo = new ByteArrayOutputStream(); try { ObjectOutputStream os = new ObjectOutputStream(bo); os.writeObject(yourobject); } catch (Exception e) { // problem with serialization - get the message from the exception } Fred Toussi -------------------- Steve Ingersoll wrote: I am running 1.7.0. I originaly had the object passed directly in but that also had the problem. I was at one point getting a class cast exception for a different reason which I thought was on the execute call but it turned out to be on the statement insert call since it was not initialized at that point. I fixed the problem but never went back and change it to pass the object directly. Thanks Steve Ingersoll -------------------- Please report which version of software you are using. Versions prior to 1.7.0 had problems with objects. In your code you do not have to define a new variable and cast your object to Object. Every java object is an Object. Fred Toussi -------------------- Steve Ingersoll wrote: I am getting a "Serialization failure: 40001" doing an insert command from within a Java program. I am trying to create a table that contains a java object. The create statement I am using is: Statement stmnt = conn.createStatement(); stmnt.executeUpdate( "CREATE TABLE Users " + "( username VARCHAR PRIMARY KEY," + " pwdRecord OBJECT )"); This seems to work ok but when I do the following is when I get the error: PreparedStatement insertStatement = conn.prepareStatement( "INSERT INTO Users (username, pwdRecord) VALUES (?, ?)"); insertStatement.setString(1, pwdEntry.getUsername()); Object pwdRecord = (Object)pwdEntry; insertStatement.setObject(2, pwdRecord); //insertStatement.setNull(2,java.sql.Types.JAVA_OBJECT); System.out.println("Before execute"); insertStatement.executeUpdate(); System.out.println("After execute"); } catch (SQLException ex) { System.out.println("Exception: " + ex); throw ex; } If I comment out the setObject for item 2 and replace it with the setNull then the call works. The PwdEntry object is defined as: public class PwdEntry implements java.io.Serializable { ------------------------------------------------------- This sf.net email is sponsored by: viaVerio will pay you up to $1,000 for every account that you consolidate with us. http://ad.doubleclick.net/clk;4749864;7604308;v? http://www.viaverio.com/consolidator/osdn.cfm _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers