[OneToMany]List<Department> will be compiled to java.util.List<? extends Department> which cause JPA issues!

[OneToMany(mappedBy = "parentDepartment") ] val subdepartments : List<Department>? = null

will be compiled to

private java.util.List<? extends Department> subdepartments = null;

Some ORM such as Ebean, will be confused by <? extends Department>.

Now I have to write as :

[OneToMany(mappedBy = “parentDepartment”)]
var subdepartments : java.util.List<MDepartment>? = null

But the IDE will advise to use Kotlin.List or Kotlin.MutableList instead.

is there a better kotlin way ?

Thanks.

Outersky

You can use MutableList instead of List, it will not add wildcards