[2.3 java] jpa as default: what about a finder?

618 views
Skip to first unread message

Andreas

unread,
Oct 11, 2013, 12:03:31 PM10/11/13
to play-fr...@googlegroups.com
Hi,

we are about to start a project with play 2.2-java right now.

With 2.3 the ebean stack is going to be seperated into a plugin and jpa is going to become the standard implementation like on 1.x again.

Question:
Will there be a finder like concept with 2.3-jpa on ebean? The finder of ebean is really nice and with jpa we would like to have that feature as well.

Kind regards
Andreas

Christopher Hunt

unread,
Oct 11, 2013, 9:00:29 PM10/11/13
to play-fr...@googlegroups.com
My gut reaction here is that we would not want to do anything over and above what JPA provides out of the box. That said, we'd re-evaluate closer to the time.

Andreas

unread,
Oct 12, 2013, 3:06:55 PM10/12/13
to play-fr...@googlegroups.com
My guess is, that a JPA support similar powerful to the one of Play 1, would promote Play 2's java stack.
At the moment Play 2's JPA implementation is more "raw" than the one in Play 1, making the usage of the platform more "manual" and the "ramp-up" to create something quickly more heavy.

I guess what would be nice (or needed) is:
  • The functionality of Model and GenericModel to implement the basics like save() etc.
  • A finder, similar to the one of ebean (typesafe or not), best case in some kind of builder pattern.

The alternative is, that everybody is implementing these fundamentals for himself.

Marcos Pereira

unread,
Oct 13, 2013, 12:25:27 AM10/13/13
to play-framework
Just write this Model with Finder/Query support. 


What do you guys thing? Is it useful? Does it respect JPA Criteria API?

HTH

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Andreas

unread,
Oct 14, 2013, 7:22:50 AM10/14/13
to play-fr...@googlegroups.com
Bom dia Marcos,

looks actually like the concept needed in Play2@JPA!! Thanks a lot for your input!

The only thing we would add is a possibility to add criterias in brackets and custom criterias like:

  1. brackets:
    WHERE/AND ( obj.name LIKE '%abc%' OR obj.description LIKE '%abc%' OR obj.comment LIKE '%abc%')

    In an API like where().or(new ..., new...., new..)

  2. custom predefined criterias:
    WHERE/AND (obj.organisation IN ( SELECT organisation FROM abc WHERE ...)

    In an API like where().addStringCondition(....)
What do you think?
Best regards
Andreas

Marcos Pereira

unread,
Oct 15, 2013, 2:09:03 AM10/15/13
to play-framework
Hi, comments inline...



On Mon, Oct 14, 2013 at 8:22 AM, Andreas <web...@gmail.com> wrote:
Bom dia Marcos,

Bom dia. :-)
 
looks actually like the concept needed in Play2@JPA!! Thanks a lot for your input!

Thanks. But keep in mind that this is a very incomplete and untested implementation.
 

The only thing we would add is a possibility to add criterias in brackets and custom criterias like:

  1. brackets:
    WHERE/AND ( obj.name LIKE '%abc%' OR obj.description LIKE '%abc%' OR obj.comment LIKE '%abc%')

    In an API like where().or(new ..., new...., new..)
I think that this is very easy to do. Just redefine the method "or" in "Query" class to accept varargs (since Restrictions API supports varargs in or method). 
  1. custom predefined criterias:
    WHERE/AND (obj.organisation IN ( SELECT organisation FROM abc WHERE ...)

    In an API like where().addStringCondition(....)

Andreas

unread,
Oct 15, 2013, 4:50:59 AM10/15/13
to play-fr...@googlegroups.com
Hi,

we will use your implementation as a bootstrap, implement the generic use cases missing and add some test coverage.
When we are finished, we will convey the implementation in this discussion.

Best regards, Andreas

Loic

unread,
Oct 21, 2013, 4:05:45 AM10/21/13
to play-fr...@googlegroups.com
I agree, it would be great to have a good JPA support
JPA support in Play was really nice

Loic

unread,
Oct 21, 2013, 4:06:26 AM10/21/13
to play-fr...@googlegroups.com
"JPA support in Play was really nice" <- I mean in Play 1 :)

Jens Jäger

unread,
Dec 29, 2013, 11:51:28 AM12/29/13
to play-fr...@googlegroups.com
Hi Marcos,

in my project I did some polishing on your gist the results are pushed to https://github.com/jensjaeger/play4jpa

Thanks for sharing your code.

Jens
Reply all
Reply to author
Forward
0 new messages