Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception : Persistent class has non-persistent superclass: java.util.HashMap

Neelkamal-OracleJun 27 2016 — edited Jun 28 2016

Hello,


I am running into this exception : Persistent class has non-persistent superclass: java.util.HashMap


Here is my class declaration :

public class foo extends HashMap<foo1, foo2[]> { }


From the PersistentProxy documentation looks like it is not allowed : " A proxied class may not be used as a superclass for a persistent class or entity class"


@Persistent(proxyFor = HashMap.class)

public class PersistentProxyForHashMap implements PersistentProxy<HashMap<foo1,foo2[]>> {

  foo1 Key;

  foo2[] Value;

  private PersistentProxyForHashMap() {}

  @Override

  public HashMap<foo1,foo2[]> convertProxy() {

  HashMap<foo1,foo2[]> h1 = new HashMap<foo1,foo2[]>();

  h1.put(Key, Value);

  return h1;

  }

  @Override

  public void initializeProxy(HashMap<foo1,foo2[]> arg0) {

  Key = (foo1) arg0.keySet();

  Value = arg0.get(Key);

  }

}


How can I workaround this restriction ?


Also, I have read that built-in proxy class is available for HashMap. How can i use that ?

Thanks,
Neel

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2016
Added on Jun 27 2016
1 comment
1,009 views