problem with Serialize.store

From: Daniele <daniele(at)telvia(dot)it>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: problem with Serialize.store
Date: 2002-06-23 18:07:47
Message-ID: 200206232007.47011.daniele@telvia.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I've a problem with Serialize.store.

I get this message:

Exception in thread "main" java.sql.SQLException: ERROR: Attribute
'miaclasse' not found

at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:103)
at org.postgresql.Connection.ExecSQL(Connection.java:398)
at org.postgresql.Connection.ExecSQL(Connection.java:381)
at org.postgresql.util.Serialize.storeObject(Serialize.java:392)
at org.postgresql.util.Serialize.store(Serialize.java:278)
at Connessione.main(Connessione.java:18)

for the attached piece of code (3 class). I don't get this message If I
declare attribute "m" of class prova "private" or "protected".

Someone can help me?
THANK'S!!!!

************************************************
Connessione.java (main class)
************************************************
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import org.postgresql.core.QueryExecutor;

public class Connessione
{

public static void main(String args[]) throws Exception
{
org.postgresql.Connection conn;
prova m = new prova();
prova obj;
Class.forName("org.postgresql.Driver");
conn =
(org.postgresql.Connection)DriverManager.getConnection("jdbc:postgresql:provaASI",
"daniele",""); // works
org.postgresql.util.Serialize.create(conn, m); // makes problems
org.postgresql.util.Serialize s = new Serialize(conn,m);
int oid = s.store(m);
obj = (prova)s.fetch(oid);
System.out.println(obj.number);
}
}
************************************************
End Connessione.java
************************************************

************************************************
prova.java
************************************************
import java.io.*;
import java.sql.SQLException;

public class prova implements Serializable {

public int number;
public miaclasse m;

public prova() throws ClassNotFoundException,
FileNotFoundException,IOException, SQLException
{
number=4;
m = new miaclasse();
}
}
************************************************
End prova.java
************************************************

************************************************
miaclasse.java
************************************************
import java.io.*;
import java.sql.SQLException;

public class miaclasse implements Serializable {

String s;
public int i;

public miaclasse() throws ClassNotFoundException,
FileNotFoundException,IOException, SQLException {
i=323;
s="stringa";
}

public String getS() {return s;}
}
************************************************
End miaclasse.java
************************************************

Browse pgsql-jdbc by date

  From Date Subject
Next Message Frederick Klauschen 2002-06-23 19:32:33 servlets and JDBC (postgresql 7.2)
Previous Message Varun Kacholia 2002-06-23 09:32:08 Interrupt execution