scalatra < squeryl < select ALL | Always -
I want to read the elements from the database and return them as a JSON object.
The scalet is set to return the JSON database chema has been created. Find
("/") {inTransaction {list (from (MassTournamentSchema.players) (s) = & gt;)}}}
I get the following error: "Any session is not bound to the current thread, should be created through a session session .create and usually this error occurs when a transaction / Intrusion is executed outside the block. "
I want to correct it so that something like" session.create "can be added. Can not really be in the right way.
Can anyone help Skeltra-Nob? : -)
I think your comment is on the right track. InTransaction block will be bound by a JDBC connection in a thread's local variable and start the connection on it if there is no selection on the same thread, then you will see an error that you receive two things that I recommend that you try Are:
Start your transaction later
from the list (from (invoice) {to (MassTournamentSchema.players) (s = & gt; select)) })
I am not familiar with the list of Skeleton, but it is possible That he is accepting sub-name parameter and it is then executed on a separate thread.
Query
inTransaction {list (from (MassTournamentSchema.players) (s = & gt; Select). ToList)}
Here the query object's Square Object will be returned to the Scala list and will be saved from any lazy evaluation errors later due to recurrence.
Comments
Post a Comment