Issue #670: javax.persistence.PersistenceException Attempt to store an instance of a non persistable type java.net.URL

Type: Feature RequestVersion: 2.3.6Priority: NormalStatus: ClosedReplies: 4
#1

ObjectDB 2.3.6_16:

The following works in EclipseLink+MySQL and EclipseLink+Oracle:

public Link(String name, String $url) //throws MalformedURLException
    {
        this.name = name;
        try {
            url = new URL($url);
        } catch (MalformedURLException ex) {
            log_error(ex);
        }
    }

private URL url;

 

    public URL getUrl() {
        return url;
    }

    public void setUrl(URL url) {
        this.url = url;
    }

 

I can rewrite this to simply check whether it is a valid URL $url string and storing it.

I can return getURL also as transient to keep my public contract.

But it would be nice to have URLs stored directly.

 

 

 

#2

This post was moved to a forum thread.

Reopen this issue if you still cannot persist URL after changing the configuration.

ObjectDB Support
#3

I've set <persist serialization="true" /> in objectdb.conf, but still got this exception. Is there anything I should do on clinet?

#4

If you are using ObjectDB in client-server mode - verify that you changed the configuration on the client side.

ObjectDB Support
#5

Thanks. I forgot to set configuration file in client.

Just set System.setProperty("objectdb.conf", "[PATH of objectdb.conf]"); before open database.

Reply