我真的只是scala中的域模型:
package models
import org.joda.time.DateTime
import com.google.code.morphia.annotations.Entity;
import play.data.validation.Required;
import play.modules.morphia.Model;
@Entity
class User(@Required val cid: String, val isAdmin: Boolean = false, @Required val dateJoined: DateTime = new DateTime() ) extends Model
测试代码:
if (User.filter("cid", session.getId).get() == null) {
....
}
第一行测试代码抛出错误:
编译错误 无法编译文件/app/controllers.scala。引发的错误是:值过滤器不是对象models.User
的成员我无法解决此问题。这是相关的应用程序配置:
#module.morphia=${play.path}/modules/morphia-1.2.1beta6
morphia.db.host=localhost
# what's your mongodb server port
morphia.db.port=27017
# what's your database name
morphia.db.name=gem
# Authentication to your mongodb server
#morphia.db.username=user
#morphia.db.password=pass
# configure your ID field type
# could be either ObjectId or Long, default to ObjectId
morphia.id.type=Long
# Set default write concern, see http://api.mongodb.org/java/current/com/mongodb/class-use/WriteConcern.html
#morphia.defaultWriteConcern=safe
我使用play 1.2.2RC2。和morphia插件morphia-1.2.1beta6
答案 0 :(得分:0)
我认为PlayMorphia模块不适用于Scala