Domanda

I'm using the java encog library and wanted to know how to serialize the sample XOR network to a mysql database. I'm rather new to working with databases in java. I'm guessing it has to do with the EncogDirectoryPersist class but was wondering how to modify that to return something that can be sent to a database.

thanks

È stato utile?

Soluzione

It looks like you could just use normal java serialization to serialize to a byte array (look at using the commons-lang3 library to do this in one line with org.apache.commons.lang3.SerializationUtils.serialize(Serializable)), then store this in the database as a binary column.

Altri suggerimenti

Check that the class that you want to persist implements the Java Serializable interface. Then it is a simple matter to serialize that class using Java Serialization api to either a file or to a database if you desire that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top