Closed slimandslam closed 8 years ago
The solution is to make sure these are in place:
import com.avaje.ebean.Ebean; import com.avaje.ebean.Model;
then change the syntax of:
user.saveManyToManyAssociations("roles");
to
Ebean.saveManyToManyAssociations(user, "roles");
If you turn on deprecation warnings on the sample app, you get this.
[warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:11: play.db.ebean.Model in play.db.ebean has been deprecated
[warn] play.db.ebean.Model
[warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/SecurityRole.java:21: play.db.ebean.Model in play.db.ebean has been deprecated
[warn] play.db.ebean.Model
[warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:18: play.db.ebean.Model in play.db.ebean has been deprecated
[warn] Model
[warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:57: Finder(java.lang.Class,java.lang.Class
Cool, would you mind making a PR for this? You could also enable deprecation warnings in it, so in the future we will see problems like this earlier! On 9 Sep 2015 6:20 am, "J Levitt" notifications@github.com wrote:
If you turn on deprecation warnings on the sample app, you get this.
[warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:11: play.db.ebean.Model in play.db.ebean has been deprecated [warn] play.db.ebean.Model [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/SecurityRole.java:21: play.db.ebean.Model in play.db.ebean has been deprecated [warn] play.db.ebean.Model [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:18: play.db.ebean.Model in play.db.ebean has been deprecated [warn] Model [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/TokenAction.java:57: Finder(java.lang.Class
,java.lang.Class) in com.avaje.ebean.Model.Finder has been deprecated [warn] new Finder( [warn] Long.class, TokenAction.class) [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/User.java:64: Finder(java.lang.Class,java.lang.Class) in com.avaje.ebean.Model.Finder has been deprecated [warn] new AppModel.Finder( [warn] Long.class, User.class) [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/SecurityRole.java:28: play.db.ebean.Model in play.db.ebean has been deprecated [warn] Model [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/SecurityRole.java:39: Finder(java.lang.Class,java.lang.Class) in com.avaje.ebean.Model.Finder has been deprecated [warn] new Finder( [warn] Long.class, SecurityRole.class) [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/LinkedAccount.java:26: Finder(java.lang.Class,java.lang.Class) in com.avaje.ebean.Model.Finder has been deprecated [warn] new Finder( [warn] Long.class, LinkedAccount.class) [warn] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/UserPermission.java:24: Finder(java.lang.Class,java.lang.Class) in com.avaje.ebean.Model.Finder has been deprecated [warn] new AppModel.Finder( [warn] Long.class, UserPermission.class)
— Reply to this email directly or view it on GitHub https://github.com/joscha/play-authenticate/issues/277#issuecomment-138688241 .
The solution to the Finder deprecation warnings is to change all the statements that use Finder from this:
public static Finder<Long, MyFile> find = new Finder<Long, MyFile>(Long.class, MyFile.class);
To this:
public static Finder<Long, MyFile> find = new Finder<Long, MyFile>(MyFile.class);
I'm pretty sure the other deprecation warnings can be eliminated by changing the import from this:
import play.db.ebean.Model
to
import com.avaje.ebean.Model
All of the Play-Authenticate routines in the onStart method in the app/Global.java file need to be migrated per instructions here: https://www.playframework.com/documentation/2.4.x/GlobalSettings
Add the latest version of deadbolt to your build.sbt file. It produces the least amount of logging noise:
"be.objectify" %% "deadbolt-java" % "2.4.3"
fixed in aaaecd5
If you uncomment lines 175 or 176 in this file:
https://github.com/joscha/play-authenticate/tree/master/samples/java/play-authenticate-usage/app/models/User.java
The compilation of the sample app will fail with:
[error] /play-authenticate-master/samples/java/play-authenticate-usage/app/models/User.java:175: cannot find symbol [error] symbol: method saveManyToManyAssociations(java.lang.String) [error] location: variable user of type models.User [error] user.saveManyToManyAssociations