When I use Berkeley DB JE in my scala project, I define an entity with a List member. However when I run the project, it throws an exception telling that Class could not be loaded or is not persistent: scala.collection.immutable.List
. So how can I solve this problem? Or just convert scala List to java.util.List?
I found the answer by myself. Berkeley DB JE does not support List of scala, and it only supports java.util.List. So using following statement to change the scala List to java List works.
import scala.collection.JavaConverters._
val sl = List(...)
val jl = new java.util.ArrayList(sl.asJava)
Passing jl
to Berkeley DB JE by using DPL solves this problem.
Thanks.