ObjectDB ObjectDB

Using Scala collections with ObjectDB

#1

Hi,

I cannot see that it is possible to make scala collection classes persistable within ObjectDB. Am I missing something or must  ObjectDB Software Ltd do a specific incorporation of the scala.collection._  api for it to work ? (http://www.scala-lang.org/docu/files/collections-api/collections.html)

 

/Peter

 

edit
delete
#2

You are right - Scala collections require some special handling, which is not implemented yet by ObjectDB.

I will check if this could be solved in one of the next builds.

ObjectDB Support
edit
delete
#3

Following your post I ran some tests of using ObjectDB in Scala. It seems that the current version of ObjectDB works well with Scala. ObjectDB also passes all the Scala JPA tests from this blog:

http://www.hars.de/2009/03/jpa-with-scala.html

Regarding Scala collections - unfortunately they are incompatible with requirements of JPA and will not be supported by ObjectDB anytime soon. This is apparently a known issue. The common solution is to use Java collections for the persistent fields, and wrap them with Scala collections using properties.

See also the following related discussions:

http://blog.fakod.eu/2010/07/01/relations-with-scala-collections-and-jpa/

https://www.scala-lang.org/old/node/5505

ObjectDB Support
edit
delete
#4

Given that the last date this issue was discussed was in 2011 (and the links are even older), is there any update in the support of native Scala (2.10.x) collections within ObjectDB?  We want to leverage the high performance of ObjectDB for an embedded database but want to avoid introducing workarounds that negate this benefit.

edit
delete
#5

As indicated in the post from 2011, Scala collections are incompatible with JPA.

A possible solution is to use Java collections for the persistent fields, and wrap them with Scala collections using properties. The effect on performance is expected to be minimal.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.