Ebean With Play-Enhancer

194 views
Skip to first unread message

Pierre Adam

unread,
Jun 24, 2021, 4:08:58 AM6/24/21
to eb...@googlegroups.com
Hello there,

The Play Framework Enhancer that is being used to enhance the classes for Ebean has been archived and will not see any new development.

My question would be, is there another way to achieve the same result ?

Basically my goal right now is to remove the Play-Enhancer from the Play-Ebean module for SBT but it seems that Ebean isn't happy with that even with the getter/setter existing. I always get an error "io.ebean.config.BeanNotEnhancedException".

So I guess the enhancer is adding more than just the getter/setter ? Is there a way to manually produce the expected result ? Or is it just too much ?

If someone has some insights or ideas, I'm all for it.

Sincerely,

-- 
Pierre ADAM
Head of Engineering
PayinTech  -  www.payintech.com

Rob Bygrave

unread,
Jul 1, 2021, 10:19:42 PM7/1/21
to ebean@googlegroups
>   I always get an error "io.ebean.config.BeanNotEnhancedException".

Sorry, what exactly is the error?  ... in that some packages are considered known to not need enhancement (like java, io.ebean etc).  So if people are trying to enhance entity beans that are in a subpackage of io.ebean then they would see a  BeanNotEnhancedException (because the package is skipped from an enhancement perspective).



> So I guess the enhancer is adding more than just the getter/setter

The Play enhancer added getter/setter methods etc and that occurred before the ebean enhancement. It isn't quite clear to me what you are trying here.  Noting that although we like build time enhancement (via maven/gradle plugins) we can still expect to use agent enhancement always.  That is, strictly speaking you don't need to perform any ebean enhancement at build time via say sbt as long as you want to use a java agent enhancement (runtime enhancement that occurs on class load).

We probably need to clarify what is going on here?


Cheers, Rob.


--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/CAKPuH0Lcyp04WqKr4k811WY_J8VyC-ZpMwGKKQmji0kJBUYdNQ%40mail.gmail.com.

Rob Bygrave

unread,
Jul 1, 2021, 10:43:17 PM7/1/21
to ebean@googlegroups
Perhaps to say it a different way.

Ebean enhancement works on classes so it doesn't care how those classes are compiled (java, kotlin, scala etc).
The java agent enhancement performs enhancement when classes are loaded/defined.
Those entity classes should have getter/setter type methods (not field access, it was play that magically turned field access into getter/setter calls. There isn't a strict need for getter/setter methods though, any get/mutate methods are fine)
Ebean enhancement adds it's own interceptor methods and swaps out GETFIELD / PUTFIELD calls to instead use it's interceptor methods (for dirty checking/lazy loading etc).


Why we desire to use build time enhancement (via maven plugin or gradle plugin) is so that:
- We no longer need to specify the java agent on the command line when running the built application 
- We don't pay any extra runtime cost for enhancement (as we pay that cost at build time).

So say we have an app using sbt. That has entity beans and @Transactional methods etc ... as long as we have the javaagent command line argument specifying the ebean agent ... then all the ebean enhancement will occur (when the classes are loaded/defined).  So if we have the intellij idea plugin installed and on it will add that javaagent to the command line then all enhancement would occur as expected.


Note: we can get the ebean-agent to output debug via having a:

src/main/resources/ebean.mf

with content of:  (well, any value from 1 to 9 ... 9 being very verbose output)

debug: 3


Note that manifest files should have a trailing empty line (I think that isn't obvious when using eclipse ide).

So if using IntelliJ and we are using the ebean plugin etc then probably it is a case of adding the ebean.mf file with a debug line and checking the output (to confirm what the ebean-agent is doing wrt enhancement).  The downside here is that in an ideal world we use build time enhancement to make our production service that little bit faster (as enhancement is already done, doesn't need to occur at runtime).


Cheers, Rob.
Reply all
Reply to author
Forward
0 new messages