
Slick: a modern database query and access library for Scala - LiveTheDream
http://slick.typesafe.com/
======
boyter
The problem I can see is that its not totally type safe as you still need to
run the code to check that your entity is compatible with the underlying table
at runtime. If I am wrong here please correct me. It appears fairly easy to
make a mistake on the datatype (Int vs Long) and have it blow up in your face
when you run it. Sure the re-factoring is simple but I don't want to wait till
runtime to catch these issues.

I don't think that its not achievable either. I think that LINQtoSQL and
EntityFramework are the best implementation of database access that exists
today. Import the database/table select over it with 95% assurance that the
query will work at runtime and with the correct types. I really wish something
like this existed in the Java world as I would switch in a heartbeat.

For the record I code C# mostly in my day job, but every time I move over to
PHP/Java/Scala I miss LINQ. I am working with Play! at the moment and while
the DB access is the best I have come across in the Java world, its still not
at the same standard. I am still getting issues with simple selects where I
should be using a Long rather then an Int.

~~~
RasputinJones2
>> The problem I can see is that its not totally type safe as you still need
to run the code to check that your entity is compatible with the underlying
table at runtime. If I am wrong here please correct me.

With pleasure. You are wrong. SLICK (formerly known as ScalaQuery) is
Typesafe.

>> I am working with Play! at the moment and while the DB access is the best I
have come across in the Java world

I've been working with Scalaquery with Play 2 for two months now. The
experience has been fantastic. I haven't really had any queries I haven't been
able to create even complex joins.

The approach where queries are made like Scala collections is really
intuitive. Compared to you I just started using linq recently for a work
related project. Basically coming from the other end and I've been quite
pleased that the SQ skills I've built over the past month transferred over
reasonably well. I only have good things to say about Slick. You should try it
out.

~~~
boyter
Its only typesafe if you generate against the database though correct? Its
entirely possible for me to write it by hand, and not know there is a problem
till runtime yes? I want to close this loop, and LINQ is the only db access I
have tried that does so.

Should have mentioned I am using Scala for the DB access in Play 2.0 and the
other portions are mostly Java (heavy lifting done in existing libraries, so
its just plumbing work hence doing it in Java). I am pretty happy with it
except I still hit type issues which I would never encounter in LINQ.

I guess the way im looking at it is that LINQ solved a pain point for me which
I am still experiencing in other languages. I would very much like someone to
take the pain away from me, either by getting C# working well on Linux or
bringing some of the features from C# over into the Java world.

------
agentcoops
Glad to see a standard Scala DB solution emerge---especially one backed by
Typesafe. I really found the lack of an elegant database solutions in Scala to
be a huge setback in heavy Scala use a year ago. Excited to give it a try.

~~~
factorialboy
Squeryl <http://squeryl.org/> has been around a while!

~~~
agentcoops
Yes, there were lots of solutions a while back, including Slick's predecessor
ScalaQuery, but none of them were that developed and it required you to build
a fresh object model from whatever legacy schema you had. Not difficult to
automate, but with so many solutions and it being entirely unclear which would
survive, it was difficult to justify even that minimal effort of converting
and testing. In the end, I found a modified version of <https://wiki.scala-
lang.org/display/SYGN/Simplifying-jdbc> to be best for my purposes at the
time.

------
factorialboy
To me it looks inspired by Squeryl <http://squeryl.org/>

~~~
LiveTheDream
It's actually based on ScalaQuery (<http://scalaquery.org/>).

