playframework / play-scala-isolated-slick-example Goto Github PK
View Code? Open in Web Editor NEWExample Play Slick Project
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
Example Play Slick Project
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
How do you deploy this to Heroku given that they use DATABASE_URL env var?
How to configure the Mysql database, automatically generated code?
mac:play-scala-isolated-slick-example tony$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
mac:play-scala-isolated-slick-example tony$
After firing up the server in dev mode with sbt flyway/flywayMigrate slickCodegen run
a subsequent change to the template index.scala.html
will cause the following error after attempting to reload the web page:
[error] java.lang.RuntimeException: Failed to run slick-codegen: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-196]
How do we ensure the shutdown hook for closing the DB connection is called after a template is recompiled?
In your project controllers.Application is defined to a class but a object.
in this case , the compiler will response message like follow :
"object Application is not a member of package controllers Note: class Application exists, but it has no companion object."
Hi, I was looking at the internet for some example with Slick + Play + Scala to use test unit. It is very hard to find and it is a pit that this one is not working yet. If you have some time to fix it, this will help me a lot to learn how to configure my play web app to execute unit test with slick also.
Thanks. Here are the errors when I execute sbt test
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:30: not found: value Users
[error] (id: Rep[String]) => Users.filter(_.id === id))
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:33: not found: type UsersRow
[error] val f: Future[Option[UsersRow]] = db.run(queryById(id).result.headOption)
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:64: not found: type UsersRow
[error] private def usersRowToUser(usersRow: UsersRow): User = {
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:38: not found: value Users
[error] val f = db.run(Users.result)
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:52: not found: value Users
[error] Users += userToUsersRow(user.copy(createdAt = DateTime.now()))
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:60: not found: type UsersRow
[error] private def userToUsersRow(user: User): UsersRow = {
[error] ^
[error] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:61: not found: value UsersRow
[error] UsersRow(user.id, user.email, user.createdAt, user.updatedAt)
[error] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:11: Unused import
[warn] import scala.language.implicitConversions
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:29: private val queryById in class SlickUserDAO is never used
[warn] private val queryById = Compiled(
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/src/main/scala/com/example/user/slick/SlickUserDAO.scala:60: private method userToUsersRow in class SlickUserDAO is never used
[warn] private def userToUsersRow(user: User): UsersRow = {
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/target/scala-2.12/src_managed/main/com/example/user/slick/Tables.scala:11: Unused import
[warn] import profile.api._
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/target/scala-2.12/src_managed/main/com/example/user/slick/Tables.scala:12: Unused import
[warn] import com.github.tototoshi.slick.H2JodaSupport._
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/target/scala-2.12/src_managed/main/com/example/user/slick/Tables.scala:13: Unused import
[warn] import org.joda.time.DateTime
[warn] ^
[warn] /home/felipe/Downloads/play-scala-isolated-slick-example/modules/slick/target/scala-2.12/src_managed/main/com/example/user/slick/Tables.scala:14: Unused import
[warn] import slick.model.ForeignKeyAction
[warn] ^
[warn] 7 warnings found
[error] 7 errors found
[error] (slick/compile:compileIncremental) Compilation failed
[error] Total time: 28 s, completed Feb 2, 2018 10:50:15 AM
Hi,
I know this example is an isolated example, but are there any examples of using the codegen with play-slick? Can I simply mix in the Table trait generated by slick-codegen into my DAO/Service classes?
Thanks
The isolated sample uses:
but this isn't clearly documented as a requirement for a non-blocking application like Slick
It'd be awesome if this repo was forked with an example of how to cross-build ScalaJS with Play configured as per this repo...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.