开发者

Play MongoDB Morphia plugin throws error

开发者 https://www.devze.com 2023-03-16 08:37 出处:网络
I have really simply domain model in scala: package models import org.joda.time.DateTime import com.google.code.morphia.annotations.Entity;

I have really simply domain model in 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

the test code:

if (User.filter("cid", session.getId).get() == null) {

....
}

the first line of test code throws error:

Compilation error The file /app/controllers.scala could not be compiled. Error raised is : value filter is not a member of object models.User

I am unable to fix this problem. This is related application conf:

#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.defaultWriteCo开发者_运维技巧ncern=safe

I using play 1.2.2RC2. and morphia plugin morphia-1.2.1beta6


I don't think PlayMorphia module works with Scala

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号