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.