In game 2.3.3, does the object have to be installed?

in game 2.1.1, entity Login.java:

public class Login {
    @NotBlank(message = "login account cannot be empty")
    public String mobile;
    @NotBlank(message = "login password cannot be empty")
    public String password;
    public Integer ownInnId;
    public InnAdmin admin;
    public String token;
}

      

but in game 2.3.3, the error message is:

play.api.Application $$ anon $ 1: Execution Exception [[IllegalStateException: JSR-30 3 asserted property 'password' does not have appropriate access for data binding - check DataBinder configuration (bean property vs direct fie ld)]] at play.api .Application $ class.handleError (Application.scala: 296) ~ [play_ 2.11-2.3.3.jar: 2.3.3] at play.api.DefaultApplication.handleError (Application.scala: 402) [play_ 2.11-2.3.3 .jar: 2.3.3] at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 3 $$ anonfun $ applyOrElse $ 4.apply (PlayDefaultUpstreamHandler.scala: 320) [play_2.11-2.3.3.jar: 2.3.3 ] at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 3 $$ anonfun $ applyOrElse $ 4.apply (PlayDefaultUpstreamHandler.scala: 320) [play_2.11-2.3.3.jar: 2.3.3] in scala.Option.map (Option.scala: 145) [scala -library-2.11.2.jar: na] Thrown: java.lang.IllegalStateException: JSR-303 password with property asserted 'does not have appropriate access for data binding - check your DataBinde r (bean property versus direct field access) in play.data.Form.bind (Form.java:349) ~ [play-java_2.11-2.3.3.jar: 2.3.3] in play.data.Form. bindFromRequest (Form.java:221) ~ [play-java_2.11-2.3.3. jar: 2.3.3] on controllers .Application.spLogin (Application.java:295) ~ [classes /: na] at Routes $$ anonfun $ routes $ 1 $$ anonfun $ applyOrElse $ 132 $$ anonfun $ apply $ 132. apply (routes_routing.scala: 3309) ~ [classes /: na] at Routes $$ anonfun $ routes $ 1 $$ anonfun $ applyOrElse $ 132 $$ anonfun $ apply $ 132. apply (routes_routing.scala: 3309) ~ [classes /: na] Reason:org.springframework.beans.NotReadablePropertyException: Invalid rty request 'password' from bean class [bean.vo.Login]: bean property 'password' does not return acceptable or has an invalid getter: does the getter return type match the setter parameter type? at org.springframework.beans.BeanWrapperImpl.getPropertyValue (BeanWrappe rImpl.java:725) ~ [spring - beans -4.0.3.RELEASE.jar: 4.0.3.RELEASE] at org.springframework.beans.BeanWrapperImpl.getPropertyValue rImpl.java:716) ~ [spring - beans -4.0.3.RELEASE.jar: 4.0.3.RELEASE] at org.springframework.validation.AbstractPropertyBindingResult.getActua lFieldValue (AbstractPropertyBindingResult.java:99) ~ [spring -context- 4.0.3.RELEAS E.jar: 4.0.3.RELEASE] at org.springframework.validation.AbstractBindingResult.rejectValue (Abst ractBindingResult.java:108) ~ [spring-context-4.0.3.RELEASE.jar: 4.0.3.RELEASE] in play.data.Form.bind (Form.java:343) ~ [play-java_2. 11-2.3.3.jar: 2.3.3] [error] application - play onError ... POST / spLogin Execution exception [[IllegalS tateException: JSR-303 checked property 'password' does not match ng for data binding - check DataBinder configuration (bean prope rty versus direct field access)]]does not match ng for data binding - check DataBinder config (bean prope rty versus direct field access)]]does not match ng for data binding - check DataBinder config (bean prope rty versus direct field access)]]

in game 2.3.3, should the object be installed?

+3


source to share


4 answers


Play doesn't force you to define getters / setters. You can declare and use them, or access public fields directly.

In the background, Ebean will still create getters / setters after compilation, so you won't be able to use them in your code.



As for your error, try cleaning the project and then compiling it again:

$ play clean-all
$ play compile

      

+2


source


If your question is:

In game 2.3.3, should every attribute of a model have getters and setters when using Ebean?



The answer is no. A public field is sufficient for ebean to work.

0


source


You don't need getters and setters, a public field is enough.

Your problem is with your annotations: you should use instead @Required

.

0


source


The Play Framework version is 2.3.8.

  activator clean
  activator clean-files

      

0


source







All Articles