Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] JPA and Scala

Configuring EclipseLink to use a special Collection would not be overly difficult. For Eager relationships you should be able to update the CollectionMapping to use the Buffer collection type. mapping.useCollectionClass(<java Buffer class>) to use a class that implements java.util.Collection. If Buffer does not implement Collection then you will need your own CollectionPolicy for Buffer and set that on the CollectionMapping. For Lazy relationships you will need to create a lazy version of the Buffer that can be used by EclipseLink see IndirectList for an example of how the Lazy loading works.

Metadata may be a problem and you would have to address any validation issues as they arose. If the Java impl of Buffer implements List then there may not be any Metadata processing issues.


Christopher Schmidt wrote:
Hi all,

I am working on a JPA wrapper for Scala and I think that I have found an elegant way to use some ideas of JPA.

I managed to wrap EntityManager, EntitiyManagerFactory and Query.

Unfortunately, there is no simple and elegant way to use Scala's collections. Using Scala classes as entities works fine, as long they are using java.lang.List (and the other collections that are specified).
My question is: What would it mean (in terms of effort and knowledge) to allow a Scala collection (f.e. a Buffer) as a OneToMany entity attribute?

Regards Christopher

PS: Buffer is Scala's mutable "List" implementation (see

If you are interested look at (description) and (code) _______________________________________________
eclipselink-dev mailing list

Back to the top