Scala Slick 3.1.0 StackOverflow error after code generation

318 Views Asked by At

I've started using the Slick framework and the Code Generator that it's recommended to use. My problem is that after I generate the code for a table with more than 22 columns (I know about the limits, but the Code Generator let me get over it easily), I just can't compile the project anymore. I'm getting this error:

Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
java.lang.StackOverflowError
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I have searched through the whole internet and didn't come up with a solution to this error, in the actual version of Slick 3.1.0.

2

There are 2 best solutions below

0
On

the slick / shapeless "slickless" library allows you to use slick and get past the hard 22 column (case class-induced) restriction:

https://underscore.io/blog/posts/2015/08/08/slickless.html

1
On

This is to do with a Scala limit of 22 'things' in a Tuple. There's more information on it over here on why this is the case.

22 columns in a database table is rather a lot though, so I would suggest if it was possible to split that up into multiple joined tables that would be a way around the issue.

Or indeed wait until Typesafe fix the issue in a future version of Scala. If indeed that ever happens.