openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: JPA and Scala
Date Fri, 21 May 2010 19:26:44 GMT
Hi Christopher,
I took a quick look at your links.  Interesting ideas.  Of course, the
easiest way to allow for Scala Buffers is if Buffer extended Collection.  I
don't know anything about your Buffer architecture or implementation, so I
don't know if this is even a doable question or not.  As long as your data
structure could satisfy the signature requirements, then any JPA
implementation should be good to go.

As I look at your blog post, it looks like you are hoping to work with all
three main players (OpenJPA, Hibernate, and EclipseLink).  So, are you
looking for a general solution that would work with all three?  Or, are you
looking for a more specific solution?  Supporting the Collection interface
would be the most general.

If you have to introduce new method signatures, then you're probably going
to have to develop a unique plug point for each JPA provider.  For example,
in OpenJPA we have provided various "strategies" when working with a unique
situation.  The OpenJPA extension for XML Mapping (vs Relational Mapping) is
a separate XMLValueHandler strategy.  You might need to think about creating
something like the ScalaBuffer strategy which would know how to interact
with your Buffers (vs Collections).

Just some quick thoughts after reading your post.

Kevin

On Fri, May 21, 2010 at 9:28 AM, Christopher Schmidt <
fakod666@googlemail.com> 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
>
> http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/collection/mutable/Buffer.html
> )
>
> If you are interested look at http://blog.fakod.eu/?p=855
> (description) and http://github.com/FaKod/JPA-for-Scala (code)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message