problem with Serialize.store
От | Daniele |
---|---|
Тема | problem with Serialize.store |
Дата | |
Msg-id | 200206232007.47011.daniele@telvia.it обсуждение исходный текст |
Список | 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 ************************************************
В списке pgsql-jdbc по дате отправления: