My Scala Base

Adventures in Scala

Have you discovered Scala? I did and I'm keeping track of it here, recording my experiments and lessons learned. -- Steve

Scala Blogs

Loading… Loading feed

Latest Activity

 

Blog Posts

Steve Yen

More Hibernate In Scala: Annotations versus external XML versus inline XML

I've been tweaking the Hibernate in Scala example from my previous post.



The experiment is to interleave the hbm.xml mapping information right into your plain old scala object code. Sort of like a poor man's annotation, so you can keep your meta information right snug up to your properties. This helps get around Scala's current limitations around deep annotations (so I heard).





Here's… Continue

Posted by Steve Yen on January 24, 2008 at 11:40pm — 1 Comment

Steve Yen

Hibernate with Scala example in one file

Just worked through Hibernate's tutorial, but using Scala. Googling for hints turned up info from Matt Hellige's blog(s) and Viktor Klang from the lift web group. So with a tip of the hat to them, here's a working example of using Hibernate from Scala, in a single file. Enjoy...





package scalanateimport scala.xml._

import java.util.Date

import org.hibernate._

import org.hibernate.cfg._



class Event {

var id: Long = 0L

var title: String…
Continue

Posted by Steve Yen on January 24, 2008 at 7:08pm

Steve Yen

Who would win? Lift versus the Autobots?

Found this awesome sounding creature on my lift explorations:



object User extends User with MetaMegaProtoUser[User, User with KeyedMetaMapper[Long, User]]



Meta Mega Proto User!!



Now… Continue

Posted by Steve Yen on December 28, 2007 at 10:16am

Steve Yen

Inline Scala Tables

Another whoa moment today -- ran across a pointed, concise Scala code snippet in Eric Torreborre's announcement of the specs 1.1 testing library...



"a calculator" should {

"provide an add operation" in {

"a" | "b" | "result" |>

1 ! 2 ! 3 |

5 ! 2 ! 7 |

3 ! 0 ! 3 | {

(a: Int, b: Int, result: Int) => { calc.add(a, b) must_== result }

}

}

}



The above is a great… Continue

Posted by Steve Yen on December 20, 2007 at 9:54am

Steve Yen

Hmmm, Lift Uses Maven

While trying to get the latest version of the lift web framework (0.3.0) for Scala, I updated to maven 2.0.8, and then per the announcement instructions typed...



mvn archetype:create -U \

-DarchetypeGroupId=net.liftweb \

-DarchetypeArtifactId=lift-archetype-blank \

-DarchetypeVersion=0.3.0 \

-DremoteRepositories=http://scala-tools.org/repo-releases \

-DgroupId=com.test…
Continue

Posted by Steve Yen on December 19, 2007 at 9:30pm

comp.lang.scala

Loading… Loading feed

comp.lang.scala.user / Scala Lounge

Loading… Loading feed

 
 
 

comp.lang.scala.announce

Loading… Loading feed

© 2012   Created by Steve Yen.   Powered by .

Badges  |  Report an Issue  |  Terms of Service