playframework / play-scala-anorm-example Goto Github PK
View Code? Open in Web Editor NEWExample Play Database Application using Anorm
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
Example Play Database Application using Anorm
Home Page: https://developer.lightbend.com/start/?group=play
License: Creative Commons Zero v1.0 Universal
The resolvers line is unnecessary and insecure (since it uses http instead of https)
There is no problem when using Akka HTTP server, but after switching to Netty, when I run sbt run
(development mode) the first page shown is Database 'default' needs evolution!
.
After clicking Apply this script now!
application hangs.
Internally there is a deadlock.
One thread (play-dev-mode-akka.actor.default-dispatcher-<n>
) is inside this synchronized block waiting for this asynchronous instruction to finish and another thread (netty-event-loop-<n>
) trying to enter the same synchronized block.
Here is the repo showing this problem. Just execute sbt run
. My execution log is here.
Currently the distinct execution context for db operations is only on the 2.6.x branch, should be backported.
Hello, will there be an update to this template for Play 2.6 and Anorm?
Cloning the repo and running either activator test
(or activator new
) results in AnormException:
[info] Compiling 3 Scala sources to /Users/hakan/Workspaces/Learning/Play/play-anorm/target/scala-2.11/test-classes...
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-0 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] ModelSpec:
[info] Computer model
[info] - should be retrieved by id
[info] - should be listed along its companies
[info] - should be updated if needed
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-0 - is closing down.
[info] IntegrationSpec:
[info] Application
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-1 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[error] application -
! @70490j46c - Internal server error, for (GET) [/computers] ->
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[AnormException: ColumnName(COMPUTER.NAME,Some(NAME))]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:280)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:206)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:98)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Caused by: anorm.AnormException: ColumnName(COMPUTER.NAME,Some(NAME))
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-1 - is closing down.
[info] - should work from within a browser *** FAILED ***
[info] org.openqa.selenium.NoSuchElementException: Element not found
[info] For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
[info] Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
[info] System info: host: 'HMBP.local', ip: '192.168.1.50', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_77'
[info] Driver info: driver.version: unknown
[info] at org.fluentlenium.core.domain.FluentListImpl.first(FluentListImpl.java:27)
[info] at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(IntegrationSpec.scala:16)
[info] at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(IntegrationSpec.scala:13)
[info] at play.api.test.PlayRunners$class.running(Helpers.scala:99)
[info] at play.api.test.Helpers$.running(Helpers.scala:382)
[info] at play.api.test.PlayRunners$class.running(Helpers.scala:87)
[info] at play.api.test.Helpers$.running(Helpers.scala:382)
[info] at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(IntegrationSpec.scala:13)
[info] at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(IntegrationSpec.scala:13)
[info] at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(IntegrationSpec.scala:13)
[info] ...
[info] FunctionalSpec:
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-2 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] HomeController
[info] - should redirect to the computer list on /
[info] - should list computers on the the first page *** FAILED ***
[info] anorm.AnormException: ColumnName(COMPUTER.NAME,Some(NAME))
[info] ...
[info] - should filter computer by name
[info] - should create new computer
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-2 - is closing down.
[info] ScalaTest
[info] Run completed in 11 seconds, 896 milliseconds.
[info] Total number of tests run: 8
[info] Suites: completed 3, aborted 0
[info] Tests: succeeded 6, failed 2, canceled 0, ignored 0, pending 0
[info] *** 2 TESTS FAILED ***
[error] Failed: Total 8, Failed 2, Errors 0, Passed 6
[error] Failed tests:
[error] IntegrationSpec
[error] FunctionalSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 26 s, completed May 13, 2016 12:39:45 PM
First thanks for the source code.
can you please guide one one who to switch to sql server or postgresql for example?
Is there a plans for updating this sample to 2.3.x branch?
according the docs it should be
views.html.list(
right?
def list(page: Int, orderBy: Int, filter: String) = Action.async { implicit request =>
computerService.list(page = page, orderBy = orderBy, filter = ("%" + filter + "%")).map { page =>
Ok(html.list(page, orderBy, filter))
}
}
https://github.com/playframework/play-scala-anorm-example/blob/2.6.x/conf/routes#L9
GET /computers controllers.HomeController.list(p:Int ?= 0, s:Int ?= 2, f ?= "")
means that you can inject your own filter by using an "f" query parameter.
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.