User.scalajava.util.prefs.BackingStoreException it'cause記録保存するとき:生のレコードは自分自身
import net.liftweb.record.{ MegaProtoUser, MetaMegaProtoUser }
import net.liftweb.squerylrecord.RecordTypeMode._
import net.liftweb.common._
import net.liftweb.util.FieldError
import net.liftweb.http.S
class User extends MegaProtoUser[User] {
def meta = User
protected def valUnique(errorMsg: => String)(email: String): List[FieldError] = {
List[FieldError]()
}
}
/**
* The singleton that has methods for accessing the database
*/
object User extends User with MetaMegaProtoUser[User] {
override def basePath = "profile" :: Nil
override def signupFields = email :: password :: Nil
override def signupXhtml(user: TheUserType) = {
(<form method="post" action={ S.uri }><table>
<tr><td colspan="2">{ S.??("sign.up") }</td></tr>
{ localForm(user, false, signupFields) }
<tr><td> </td><td><user:submit class="btn btn-primary" /></td></tr>
</table></form>)
}
override def screenWrap = Full(<lift:surround with="default" at="content">
<lift:bind/>
</lift:surround>)
// redefine login form for nice formatting
override def loginXhtml =
<form method="post" action={ S.uri }>
<lift:msg show="All"/>
<div style="margin-bottom: 5px; margin-left: 5px;">
<strong>
{ S.??("log.in") }
</strong>
</div>
<div style="float: left; line-height: 2.5em;margin-left: 5px; margin-right: 20px;">
{ S.??("email.address") }<br/>{ S.??("password") }<br/>
<a href={ lostPasswordPath.mkString("/", "/", "") }>
{ S.??("recover.password") }
</a>
</div>
<div style="line-height: 2.5em;">
<user:email/>
<br/>
<user:password/>
<br/>
<user:submit class="btn btn-primary"/>
</div>
</form>
protected def userFromStringId(id: String): Box[User] = from(PPSchema.users)(u =>
where(u.id === id.toLong)
select (u)).headOption
protected def findUserByUserName(email: String): Box[User] = from(PPSchema.users)(u =>
where(u.email === email)
select (u)).headOption
protected def findUserByUniqueId(id: String): Box[User] = userFromStringId(id)
}
は、私はクラスのユーザーにコードの下にit.addしまっ保存されません。
override def saveTheRecord() : Box[User] = {
val u = User.createRecord.email(email.is).password(password.is).firstName(firstName.is).lastName(lastName.is).validated(validated.is).superUser(superUser.is)
Full(PPSchema.users.insert(u))
}
エラーメッセージは以下の通りです:
メッセージ:java.util.prefs.BackingStoreException:生のレコードは自分自身に net.liftweb.record.Record $ class.saveTheRecord(Record.scalaを保存しないでください。 (ProtoUser.scala:294) net.liftweb.proto.ProtoUser $ class.actionsAfterSignup (ProtoUser.scala:696) com.posplus.model.User $ .actionsAfterSignup(User.scala:32) net.liftweb.proto.ProtoUser $ class。 testSignup $ 1(ProtoUser.scala:737) net.liftweb.proto.ProtoUser $$ anonfun $ innerSignup $ 1 $ 1.apply(ProtoUser.scala:745) net.liftweb.proto.ProtoUser $$ anonfun $ innerSignup $ 1 $ 1.apply (ProtoUser.scala:745) net.liftweb.http.S $ NFuncHolder $$ anonfun $ apply $ 5.apply(S.scala:190) net.liftweb.http.S $ NFuncHolder $$ anonfun $ apply $ 5.apply (TraversableLike.scala:194) scala.collection.TraversableLike $$ anonfun $ map $ 1.apply (TraversableLike.scala:194)scala.collection.LinearSeqOptimized $ class.foreach(LinearSeqOptimized.scala:59) scala.collection.immutable.List.foreach(List.scala:45) scala.collection.TraversableLike $ class.map(TraversableLike.scala:194) scala.collection.immutable.List.map(List.scala:45) net.liftweb.http.S $ NFuncHolder.apply(S.scala:190) net.liftweb.http.S $ ProxyFuncHolder.apply(S .scala:115) net.liftweb.http.LiftSession $$ anonfun $ buildFunc $ 1 $ 2.apply(LiftSession.scala:651) net.liftweb.http.LiftSession $$ anonfun $ 16 $$ anonfun $ apply $ 39.apply( LiftSession.scala:667) net.liftweb.http.LiftSession $$ anonfun $ 16 $$ anonfun $ apply $ 39.apply(LiftSession.scala:667) scala.collection.TraversableLike $$ anonfun $ map $ 1.apply(TraversableLike。スカラ:194) scala.collection.TraversableLike $$ anonfun $ map $ 1.apply(TraversableLike.scala:194) scala.collection.LinearSeqOptimized $ class.foreach(LinearSeqOptimized.scala:59) scala.collection.immutable .List.foreach(List.scala:45) scala.collection.TraversableLike $ class.map(TraversableLike.scala:194) scala.collection.immutable.List.map(List.scala:45) net.liftweb。 (LiftSession.scala:656) scala.collection.TraversableLike $$ anonfun $ flatMap $ 1。適用(TraversableLike.scala:200) scala.collection.TraversableLike $$ anonfun $ flatMap $ 1.apply(TraversableLike.scala:200) scala.collection.LinearSeqOptimized $ class.foreach(LinearSeqOptimized.scala:59) scala.collection .immutable.List.foreach(List.scala:45) scala.collection.TraversableLike $ class.flatMap(TraversableLike.scala:200) sc ala.collection.immutable.List.flatMap(List.scala:45) net.liftweb.http.LiftSession.runParams(LiftSession.scala:655) net.liftweb.http.LiftSession.processRequest(LiftSession.scala:1074) net.liftweb.http.LiftServlet.net $ liftweb $ http $ LiftServlet $$ dispatchStatefulRequest(LiftServlet.scala:414) net.liftweb.http.LiftServlet $$ anonfun $ doSession $ 1 $ 1.apply(LiftServlet.scala:279) net.liftweb.http。LiftServlet $$ anonfun $ doSession $ 1 $ 1.apply(LiftServlet.scala:279) net.liftweb.http.S $ class.net $ liftweb $ http $ S $$ wrapQuery(S.scala:1376) net.liftweb。 http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ nest2InnerInit $ 1 $$ anonfun $ apply $ 34.apply(S.scala:1524) net.liftweb.http.S $ class.net $ liftweb $ http $ S $$ doAround(S.scala:1305) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ doAround $ 1.apply(S.scala:1306) org.squeryl.dsl。 QueryDsl $ class._using(QueryDsl.scala:46) org.squeryl.dsl.QueryDsl $ class._executeTransactionWithin(QueryDsl.scala:105) org.squeryl.dsl.QueryDsl $ class.inTransaction(QueryDsl.scala:91) net.liftweb.squerylrecord.RecordTypeMode $ .inTransaction(RecordTypeMode.scala:34) bootstrap.liftweb.Boot $$ anon $ 1.apply(Boo t.scala:58) net.liftweb.http.S $ class.net $ liftweb $ http $ S $$ doAround(S.scala:1306) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ nest2InnerInit $ 1.apply(S.scala:1522) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $ class.net $ liftweb $ http $ S $$ _ nest2InnerInit(S.scala:1521) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ innerInit $ 1 $$ anonfun $適用$ 38 $$ anonfun $適用$ 39 $$ anonfun $ $ 40 $$ anonfun $を適用する$ 41.apply(S.scala:1561) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $$ anonfun $ withReq $ 1.apply (S.scala:1571) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $ class.withReq(S.scala:1570) net.liftweb.http.S $ .withReq(S.scala:48) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ innerInit $ 1 $$ anonfun $ apply $ 38 $$ anonfun $ apply $ 39 $$ anonfun $ apply $ 40.apply(S.scala:1560) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ innerInit $ 1 $$ anonfun $適用$ 38 $$ anonfun $適用$ 39.apply(S.scala:1559) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb .http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ innerInit $ 1 $$ anonfun $適用$ 38.apply(S.scala:1558) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71 ) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ innerInit $ 1.apply(S.scala:1557) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $ class.net $ liftweb $ http $ S $$ _ innerInit(S.scala:1556) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ init $ 1 $$ anonfun $適用$ 44 $$ anonfun $適用$ 45 $$ anonfun $適用$ 46 $$ anonfun $適用$ 47 $$ anonfun $適用$ 48.apply(S.scala:1594) net.liftweb.util.ThreadGlobal.doWith (ThreadGlobal.scala:71) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ init $ 1 $$ anonfun $ apply $ 44 $$ anonfun $ apply $ 45 $$ anonfun $ apply $ 46 $$ net.liftweb.http.CoreRequestVarHandler $ class.apply(Vars.scala:613) net.liftweb.http.RequestVarHandler $ .apply(Vars.scala:515) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ init $ 1 $$ anonfun $適用$ 44 $$ anonfun $適用$ 45 $$ anonfun $適用$ 46.apply(S.scala:1591) net.liftweb.http.CoreRequestVarHandler $ class.apply(V ars.scala:613) net.liftweb.http.TransientRequestVarHandler $ .apply(Vars.scala:528) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ init $ 1 $$ anonfun $ apply $ 44 $$ anonfun $ apply $ 45.apply(S.scala:1590) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $$ anonfun $ net $ liftweb $ http $ S $$ _ init $ 1 $$ anonfun $ apply $ 44.apply(S.scala:1589) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $$ $ net $ liftweb $ http $ S $$ _ init $ 1.apply(S.scala:1588) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.S $ class。 net $ liftweb $ http $ S $$ init(S.scala:1587) net.liftweb.http.S $ class.init(S。スカラ:1190) net.liftweb.http.LiftServlet.doSession $ -1(LiftServlet.scala:278) net.liftweb.http.LiftServlet.doService(LiftServlet.scala:288) net.liftweb.http.LiftServlet $$ anonfun $ doIt $ 1 $ 1.apply(LiftServlet.scala:132) net.liftweb.http.LiftServlet $$ anonfun $ doIt $ 1 $ 1.apply(LiftServlet.scala:131) net.liftweb.util.TimeHelpers $ class.calcTime( (TimeHelpers.scala:363) net.liftweb.util。ヘルパー$ .logTime(Helpers.scala:34) net.liftweb.http.LiftServlet.doIt $ 1(LiftServlet.scala:131) net.liftweb.http.LiftServlet.service(LiftServlet.scala:142) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2 $$ anonfun $ apply $ mcV $ sp $ 1 $$ anonfun $ apply $ mcV $ sp $ 2.apply $ mcV $ sp(HTTPProvider.scala:72) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2 $$ anonfun $ apply $ mcV $ sp $ 1 $$ anonfun $ apply $ mcV $ sp $ 2.apply(HTTPProvider.scala:71) net.liftweb.http .provider.HTTPProvider $$ anonfun $サービス$ 2 $$ anonfun $適用$ mcV $ sp $ 1 $$ anonfun $適用$ mcV $ sp $ 2.apply(HTTPProvider.scala:71) net.liftweb.util.ThreadGlobal.doWith( ThreadGlobal.scala:71) net.liftweb.http.URLRewriter $ .doWith(Req.scala:1253) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2 $$ anonfun $ apply $ mcV $ sp $ 1 .apply $ mcV $ sp(HTTPProvider.scala:70) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2 $$ anonfun $ apply $ mcV $ sp $ 1.apply(HTTPProvider.scala:70) net .l iftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2 $$ anonfun $ apply $ mcV $ sp $ 1.apply(HTTPProvider.scala:70) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2.apply $ mcV $ sp(HTTPProvider.scala:66) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2.apply(HTTPProvider.scala :60) net.liftweb.http.provider.HTTPProvider $$ anonfun $ service $ 2.apply(HTTPProvider.scala:60) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb。 http.provider.HTTPProvider $ class.service(HTTPProvider.scala:60) net.liftweb.http.LiftFilter.service(LiftServlet.scala:757) net.liftweb.http.provider.servlet.ServletFilterProvider $$ anonfun $ doFilter $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply $ m cV $ sp(ServletFilterProvider.scala:67) net.liftweb.http.provider.servlet.ServletFilterProvider $$ anonfun $ doFilter $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply(ServletFilterProvider.scala:62) net。リフトウエブ.ttp.provider.servlet.ServletFilterProvider $$ anonfun $ doFilter $ 1 $$ anonfun $ apply $ mcV $ sp $ 1.apply(ServletFilterProvider.scala:62) net.liftweb.http.CoreRequestVarHandler $$ anonfun $ apply $ 16 $$ anonfun $ apply $ 17 $$ anonfun $ apply $ 18 $$ anonfun $ apply $ 19.apply(Vars.scala:619) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.CoreRequestVarHandler (Vars.scala:618) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http .CoreRequestVarHandler $$ anonfun $適用$ 16 $$ anonfun $適用$ 17.apply(Vars.s (Vars.scala:616) net.liftweb.util(0) .ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.CoreRequestVarHandler $ class.apply(Vars.scala:615) net.liftweb.http.RequestVarHandler $ .apply(Vars.scala:515) ネット.liftweb.http.provider.servlet.ServletFilterProvider $$ anonfun $ doFilter $ 1.apply(ServletFilterProvider.scala:61) net.liftweb.http.provider.servlet.ServletFilterProvider $$ anonfun $ doFilter $ 1.apply(ServletFilterProvider.scala: 61) net.liftweb.http.CoreRequestVarHandler $$ anonfun $ apply $ 16 $$ anonfun $ apply $ 17 $$ anonfun $ apply $ 18 $$ anonfun $ apply $ 19.apply(Vars.scala:619) net。(Vars.scala:618) リフトウェーブ.util.ThreadGlobal.doWith net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71) net.liftweb.http.CoreRequestVarHandler $$ anonfun $ apply $ 16 $$ anonfun $ apply $ 17.apply(Vars.scala:617) net.liftweb。 (ThreadGlobal.scala:71) net.liftweb.http.CoreRequestVarHandler $$ anonfun $ apply $ 16.apply(Vars.scala:616) net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala: 71) net.liftweb.http.CoreRequestVarHandler $ class.apply(Vars.scala:615) net.liftweb.http.provider.servlet.ServletFilterProvider $ class.doFilter(ServletFilterProvider.scala:60) net.li ftweb.http.LiftFilter.doFilter(LiftServlet.scala:757) org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1337) org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler。 java:486) org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) org.eclipse.jetty .server.session.SessionHandler.doHandle(SessionHandler.java:233) org.eclipse.jetty.server.handler.ContextHandler。 _doHandle(ContextHandler.java:973) org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java) org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417) ORG。 eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907) org.eclipse.jetty.server.handler。 ScopedHandler.handle(ScopedHandler.java:117) org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java: 110) org.eclipse.jetty.server.Server.handle(Server.java:346) org.eclip httpConnection.java:442)。 HttpParser.java:801) org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224) org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) org.eclipse.jetty .io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) org.eclipse.jetty.io.nio.SelectChannelEndPoint $ 1.run(SelectChannelEndPoint.java:44) org.eclipse.jetty.util.thread.QueuedThreadPool。 runJob(QueuedThreadPool.java:598) org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:533) java.lang.Thread.run(Thread.java:680)
このProtoUserはパッケージnet.liftweb.recordにありますか?本当にありがとうございます。 – sjbwylbs
はい、私は確信しています。 Squerylが主キーとProtoUserのフィールドをどのように参照するかには互換性がありません。 beensは回避策について話していますが、まだ何も実装されていません。 –