Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where can I download 6.1.0 from? #221

Closed
geo-m opened this issue Sep 12, 2021 · 12 comments
Closed

Where can I download 6.1.0 from? #221

geo-m opened this issue Sep 12, 2021 · 12 comments

Comments

@geo-m
Copy link

geo-m commented Sep 12, 2021

The plugin version is listed in the README but it is not available anywhere

@almothafar
Copy link

From the internet they said, there is no answer for this, this question is there for a few months in #208

@felipebonezi
Copy link
Contributor

It will be fixed with #222

@franzgranlund
Copy link

Is there any status update for this? Is there a chance that it may be releases sometime?

@mkurz
Copy link
Member

mkurz commented Dec 21, 2021

I am happy to chip in and fix play-ebean, however that won't happen in december. If you want to support me, please consider donating to our collective: https://www.playframework.com/sponsors

@mkurz
Copy link
Member

mkurz commented Jan 28, 2022

play-ebean 6.2.0-RC4 released, please have a look at the release notes how to upgrade: https://github.com/playframework/play-ebean/releases/tag/6.2.0-RC4. Please test and let us know if it works for you, thanks!

@franzgranlund
Copy link

play-ebean 6.2.0-RC4 released, please have a look at the release notes how to upgrade: https://github.com/playframework/play-ebean/releases/tag/6.2.0-RC4. Please test and let us know if it works for you, thanks!

First, Thank you very much for trying to help.

I'm on very deep water here since I'm not sure why I'm running into this, but is seems like my project now compiles but the "Play enhancer" (or whatever it is, to clarify, I do NOT have addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.2.2") in the project) doesn't work anymore.

So, in my project I originally have this:
Temurin Java 1.8.0_312
Play 2.8.13
SBT 1.3.13
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "6.0.0")

everything works as expected. If I change to following:
Temurin Java 1.8.0_312
Play 2.8.13
SBT 1.6.1
addSbtPlugin("com.typesafe.play" % "sbt-play-ebean" % "6.2.0-RC4")

then everything compiles but when running the application I get errors like:

play.api.PlayException: Execution exception[[CompletionException: java.lang.IllegalStateException: JSR-303 validated property 'domain' does not have a corresponding accessor for data binding - check your DataBinder's configuration (bean property versus direct field access)]]
	at play.api.http.HttpErrorHandlerExceptions$.$anonfun$convertToPlayException$3(HttpErrorHandler.scala:388)
	at scala.Option.getOrElse(Option.scala:201)
	at play.api.http.HttpErrorHandlerExceptions$.convertToPlayException(HttpErrorHandler.scala:388)
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:373)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:453)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

I'm not sure if this is an issue with the updated SBT version or "sbt-play-ebean" % "6.2.0-RC4"

@mkurz
Copy link
Member

mkurz commented Jan 29, 2022

@franzgranlund I am pretty sure you have form classes which have public fields. play-enhancer added getter and setter methods for such fields. To bind and validate request parameters to a form class setters are needed by default. However, play-ebean 6.2.0-RC4 removed play-enhancer, so there are no setters generated anymore. That is why you get such an exception.
Solution:

  • Either add getters and setter to all your form classes (and probably make the public field private instead)
  • Or instead you can also just set play.forms.binding.directFieldAccess = true in conf/application.conf, without the need of changing code.

You can find more information here: https://www.playframework.com/documentation/2.8.x/JavaForms#Defining-a-form

As you can see, by default, you have to define getter and setter methods so Play is able to access the Form fields. You can however also enable “direct field access” (for all forms) by setting play.forms.binding.directFieldAccess = true in conf/application.conf. In this mode Play will ignore the getter and setter methods and will try to directly access the fields

@franzgranlund
Copy link

@mkurz Thank you. You are correct, I have form classes with public fields. Your solution by adding play.forms.binding.directFieldAccess = true did the trick for my forms. However, now my Ebean models won't lazy load automatically when using fields annotated with @manytoone (I'm also using public fields for my models, as shown in earlier Play Framework 2.6 Ebean examples). Is this also due to not play-enhancer being included in 6.2.0-RC4 or has it to do with the new Ebean version? Is there any setting I could use to enable that again?

@mkurz
Copy link
Member

mkurz commented Jan 29, 2022

@franzgranlund ebean got upgraded in RC4, so that might be the reason. The thing that changed by removing the play-enhancer is that there aren't getters and setters generated, so you could try to just add them to your public fields yourself (your IDE will help you to generate code) and see if lazy loading works again (if so then ebean needs those getters/setters for lazy loading to work). I am not really familiar with ebean since I never used it.

@franzgranlund
Copy link

@mkurz Yes, you are correct. I tested and Ebean needs getters and setters to work with lazy loading. I guess that this worked before since the play-enhancer was included in earlier play-ebean.

It is quite easy to start using getters and setters I guess, and my IDE will help me, no problem. But just out of curiosity, why was play-enhancer removed and can I myself add it?

I think it would be a good idea to clarify in the README that the play-enhancer is removed in this version of play-ebean.

@PromanSEW
Copy link
Contributor

@franzgranlund I got same error with JSR, also problem with public fields ( #228 )

@mkurz
Copy link
Member

mkurz commented Jan 30, 2022

But just out of curiosity, why was play-enhancer removed and can I myself add it?

It was decided by Lightbend in May 2020 to archive repos they don't see a future in, like play-enhancer. I think there are problems with Java 11 as well. Not sure how hard it would be to support newer Java versions.
In theory, if someone wants to maintaintain the library on a regular basis we could again bring it to life again, however I don't see much sense in it. What play-enhancer did was too much magic IMHO and there are very popular libraries out there (e.g. Lombok) which provide you the same functionality anyway. Also with the new record types in newer Java versions getter/setter enhancing might not be needed anymore.

FYI: I updated the release notes with notes about the problems you experienced and linked them in the README as well.

@mkurz mkurz closed this as completed Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants