Unexpected UnexpectedNullableFound(post.IMAGE) プログラムの実行中にこのエラーが発生しましたが、エラーの内容を特定できませんでした。同じエラーが発生した場合、またはエラーの詳細を知っている場合は、ここに言及してください
私のデータベースはMySqlです
私のモデルクラス、
case class Post(id: Pk[Long]= NotAssigned, name:String, image:String)
関数
def listAllPostById():List[Post]={
DB.withConnection{ implicit connection =>
val listpost =SQL(
"""
select * from POST
""").on(
).as(Post.simple.*)
listpost
}
アプリケーションでメソッド呼び出し
def listAllpost()= Action{
val post:List[Post]=Post.listAllPostById
Ok(views.html.allPosts.render(post))
}
そしてルートで
GET /allPosts controllers.Application.listAllpost
そしてページを見る
@for(post:Post<- posts){
@post.id
@post.name
@post.image}
簡単な方法
val simple ={
get[Pk[Long]]("post.id") ~
get[String]("post.name")~
get[String]("post.image") map {
case id ~ name ~ image => Post(id,name,image)
}
エラー
Execution exception
[RuntimeException: UnexpectedNullableFound(post.IMAGE)]
オンラインエラー
).as(Post.simple.*)
advnce thnx.. によって prasanth