forked from foundweekends/giter8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jto
committed
Jul 5, 2012
1 parent
98a120d
commit f714030
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package models | ||
|
||
import java.util.{Date} | ||
|
||
import play.api.db._ | ||
import play.api.Play.current | ||
|
||
import anorm._ | ||
import anorm.SqlParser._ | ||
|
||
case class $className$(id: Pk[Long] = NotAssigned, name: String) | ||
|
||
object $className$ { | ||
|
||
/** | ||
* Parse a $className$ from a ResultSet | ||
*/ | ||
val simple = { | ||
get[Pk[Long]]("$className;format="lower"$.id") ~ | ||
get[String]("$className;format="lower"$.name") map { | ||
case id~name => Company(id, name) | ||
} | ||
} | ||
|
||
def findAll: Seq[$className$] = DB.withConnection { implicit connection => | ||
SQL("select * from $className;format="lower"$ order by name").as($className$.simple *) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
className=Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters