joecks
joecks

Reputation: 4637

Serializable[] attribute in Object not stored in db4o

I ran in a strange behavior of db4o. When I persist an Object (implementing Serializable) with an attribute of Serializable[], the Array is only returned once from the store correctly then ever after only an Array with null elements.

I use db4o 7.12.

Edit

This is the POJO:

public class ResponseRowWrapper implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = 1L;


private long uuid;
private long responseUuid;
private Serializable[] row;
private long timestamp;

And this the config in spring:

        <property name="transparentActivation" value="true" />
    <property name="transparentPersistence" value="true" />
    <property name="configurationCreationMode" value="NEW" />
    <property name="lockDatabaseFile" value="false" />
    <property name="callConstructors" value="true" />
    <property name="exceptionsOnNotStorable" value="true" />

and in in the db4o Config Object:

configuration.common().objectClass(ResponseRowWrapper.class).cascadeOnUpdate(true);

Upvotes: 0

Views: 383

Answers (2)

joecks
joecks

Reputation: 4637

I solved it, but I can't tell what was wrong with a Serializable[] but it is not working, I need to use Object[] and just care by myself that there are only Serializables inside.

Upvotes: 0

German
German

Reputation: 10402

Try passing the db4o configuration object a cascadeOnActivate(true) (that causes a cascaded load) or set a higher activation depth in db4o.

Upvotes: 1

Related Questions