Im trying to create small CRUD application using play-java template.
Im using typesafe activator through cmd I create new project so now i want enable ebean and have to change mysql database. im using activator 1.3.6,
for sql im using my phpmyadmin sql 5.6.20 i googled and i did everything like documentary but still i couldn't solve my problem i couldn't add ebean my project and i couldn't connect mysql connector i did changes using this links
Ebean Mysql stackoverflow question but no use i wasted 3 days then i used play2-crud template enter link description here in this i can use eban but i dont know how to enable mysql and im using INTELLIJ IDE if anyone expert help me
2
votes
What errors do you have? I also use playframework.com/documentation/2.4.x/JavaEbean as a roadmap and got it working within few hours.
– Andriy Kuba
i create ne project ok using play-java then i uncommand in plugin.sbt file 'addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")' ok then in build.sbt i chnged (Playjava) to (Playjava, PlayEbean) when i change PlayEbean red color and thr i have add javaebean under libraryDependencies both eban red color
– Hamelraj
1 Answers
1
votes
To enable MySQL
in the application.conf
file:
# Database configuration using MySQL database engine
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://127.0.0.1/mydataabse"
db.default.username=yourusername
db.default.password="yourpassword"
and you also need to add MySQL connector to the build.sbt
libraryDependencies
:
libraryDependencies ++= Seq(
...
"mysql" % "mysql-connector-java" % "5.1.18"
)
To enable Ebean
Add Ebean plugin In to the project\plugins.sbt
:
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
Enable this plugin in the build.sbt
:
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
Configure Ebean in the conf\application.conf
to take models from your model package:
ebean.default = ["my.models.*"]