ユーザ用ツール

サイト用ツール


java:playframework:createmodel

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
java:playframework:createmodel [2018/07/24 15:57] takajava:playframework:createmodel [2018/08/27 14:56] (現在) – [設定ファイルへの定義] taka
行 6: 行 6:
 データベースを使用する場合は手動で用意する必要があります。\\  データベースを使用する場合は手動で用意する必要があります。\\ 
 その後、modelsパッケージ内に必要なモデルクラスを作成していきます。 その後、modelsパッケージ内に必要なモデルクラスを作成していきます。
 +
 +==== play-ebean ====
 +
 +まずは使用環境に合わせてplay-ebean(Ebean Plugin)のバージョンを選定します。
 +
 +{{:java:playframework:ebean_versions.jpg|}}
  
 ==== 設定ファイルへの定義 ==== ==== 設定ファイルへの定義 ====
行 18: 行 24:
  
 === conf/application.conf === === conf/application.conf ===
 +
 +  * MySQLの設定追加
  
 <sxh> <sxh>
-# This is the main configuration file for the application+db.default.driver=com.mysql.jdbc.Driver 
-# https://www.playframework.com/documentation/latest/ConfigFile+db.default.url="jdbc:mysql://<server_url>/<db_name>" 
 +db.default.user=<db_user_name> 
 +db.default.password=<db_password> 
 +</sxh>
  
-play.modules { +  * ebean.defaultにmodelsを追加
-  enabled += "play.api.db.DBModule" +
-}+
  
-play.db { +<sxh> 
-  config = "db+ebean.default="models.*
-  default = "default"+</sxh>
  
-  # Play uses HikariCP as the default connection pool.  You can override +=== build.sbt ===
-  # settings by changing the prototype: +
-  prototype { +
-    # Sets a fixed JDBC connection pool size of 50 +
-    hikaricp.minimumIdle 50 +
-    hikaricp.maximumPoolSize 50 +
-  } +
-}+
  
-db { +  * PlayEbeanの追加
-  default.driver = com.mysql.jdbc.Driver +
-  default.url = "jdbc:mysql://[IP or Hostname]/[Database]?characterEncoding=UTF8" +
-  default.username = [Username] +
-  default.password = [Password] +
-}+
  
-ebean.default ["models.*"]+<sxh> 
 +lazy val myProject (project in file(".")).enablePlugins(PlayJava, PlayEbean) 
 +</sxh> 
 + 
 +  JDBCとMySQL Connectorの追加 
 + 
 +<sxh> 
 +libraryDependencies += jdbc 
 +libraryDependencies ++= Seq( 
 +  "mysql" % "mysql-connector-java" % "5.1.24" 
 +)
 </sxh> </sxh>
java/playframework/createmodel.1532415477.txt.gz · 最終更新: 2018/07/24 15:57 by taka