Note that there are some explanatory texts on larger screens.

plurals
  1. POSorm Example causing error (not found type)
    primarykey
    data
    text
    <p>I am having trouble following the example of sorm, from the sorm <a href="http://sorm-framework.org/SORM-vs-Slick.html" rel="nofollow">website</a> Here is my code</p> <pre><code>import sorm._ case class Coffee(name: String, supplier: Supplier, price: Double, sales: Int, total: Int) case class Supplier(name: String, street: String, city: String, state: String, zip: String) object Db extends Instance( entities = Set(Entity[Coffee](), Entity[Supplier]()), url = "jdbc:mysql://address=(protocol=tcp)(host=localhost)(port=3306)(user=root)(password=test123)/test", initMode = InitMode.Create ) object sormtest { def main(args: Array[String]): Unit = { val supplier1 = Supplier("Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199") val supplier2 = Supplier("Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460") val supplier3 = Supplier("The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966") println("Hello World") Db.save(supplier1) } } </code></pre> <p>While the code does compile fine using eclipse on windows and on unix, I keep getting the following run-time error:</p> <pre><code> Hello World Exception in thread "main" java.lang.ExceptionInInitializerError at sormtest$.main(sormtest.scala:23) at sormtest.main(sormtest.scala) Caused by: scala.tools.reflect.ToolBoxError: reflective compilation has failed: not found: type Coffee not found: type Supplier too many arguments for constructor Object: ()Object at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.throwIfErrors(ToolBoxFactory.scala:319) at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.compile(ToolBoxFactory.scala:252) at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl.compile(ToolBoxFactory.scala:416) at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl.eval(ToolBoxFactory.scala:419) at sorm.persisted.PersistedClass$.createClass(PersistedClass.scala:99) at sorm.persisted.PersistedClass$$anonfun$4.apply(PersistedClass.scala:108) at sorm.persisted.PersistedClass$$anonfun$4.apply(PersistedClass.scala:108) at sext.package$$anonfun$memo$1$$anonfun$apply$3.apply(package.scala:239) at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:189) at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:91) at sext.package$$anonfun$memo$1.apply(package.scala:239) at sorm.persisted.PersistedClass$.apply(PersistedClass.scala:111) at sorm.Instance$Initialization$$anonfun$9$$anonfun$apply$17.apply(Instance.scala:233) at sorm.Instance$Initialization$$anonfun$9$$anonfun$apply$17.apply(Instance.scala:233) at embrace.package$EmbraceAny$.$$extension(package.scala:6) at sorm.Instance$Initialization$$anonfun$9.apply(Instance.scala:233) at sorm.Instance$Initialization$$anonfun$9.apply(Instance.scala:233) at scala.collection.immutable.Set$Set2.foreach(Set.scala:94) at sorm.Instance$Initialization.&lt;init&gt;(Instance.scala:233) at sorm.Instance.&lt;init&gt;(Instance.scala:29) at Db$.&lt;init&gt;(sormtest.scala:6) at Db$.&lt;clinit&gt;(sormtest.scala) ... 2 more </code></pre> <p>Any idea why I am getting type not found error?</p> <p>EDIT:</p> <p>based on the comment from @nikita-volkov I moved the cases classes inside sormtest and that solved my problem , here is the code </p> <pre><code>object sormtest { import sorm._ case class Coffee(name: String, supplier: Supplier, price: Double, sales: Int, total: Int) case class Supplier(name: String, street: String, city: String, state: String, zip: String) object Db extends Instance( entities = Set(Entity[Coffee](), Entity[Supplier]()), url = "jdbc:mysql://address=(protocol=tcp)(host=localhost)(port=3306)(user=root)(password=test123)/test", initMode = InitMode.Create ) def main(args: Array[String]): Unit = { val supplier1 = Supplier("Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199") val supplier2 = Supplier("Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460") val supplier3 = Supplier("The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966") println("Hello World") Db.save(supplier1) } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload