Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] How to force EclipseLink to use my own collection instead Java standards?

Hi!

I've created a collection class that implements Map<K, T>.
When I create the object for the first time, everything happens as expected, but once I retrive the object from database (using either find or Query), I'm getting a standard Map implementation instead my customized version.

How can I tell EclipseLink that it must use my specialized version of the collection class?
Current declaration is:

  @ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "anexo", joinColumns = @JoinColumn(name = "cadastroprofissional_id"))
  @MapKeyColumn(name = "tipo")
  public Map<String, Anexo> getAnexo() {
    if(anexo==null) {
      anexo = new AutoMap<String, Anexo>(String.class, Anexo.class);
    }

    return anexo;
  }

Where AutoMap is my specialized Map class.

Thanks,

Edson


Back to the top