Malformed class name

64 views
Skip to first unread message

carlo

unread,
Jun 16, 2015, 9:40:08 AM6/16/15
to squ...@googlegroups.com
Hi guys, I'm following this tutorial http://blog.xebia.com/2011/06/25/scala-orm-with-squeryl/ I've cloned this repo https://github.com/pbrant/squeryl_sbt_minimal_example and update the scala version to 2.11.6 and squeryl to 0.9.5-7

scalaVersion := "2.11.6"

libraryDependencies += "org.squeryl" %% "squeryl" % "0.9.5-7"

libraryDependencies += "com.h2database" % "h2" % "1.2.127"



but every time than I try create my tables using create I get this error:

java.lang.InternalError: Malformed class name
  at java.lang.Class.getSimpleName(Class.java:1203)
  at org.squeryl.internals.PosoMetaData._tryToCreateParamArray(PosoMetaData.scala:193)
  at org.squeryl.internals.PosoMetaData$$anonfun$_const$1.apply(PosoMetaData.scala:177)
  at org.squeryl.internals.PosoMetaData$$anonfun$_const$1.apply(PosoMetaData.scala:176)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
  at org.squeryl.internals.PosoMetaData._const(PosoMetaData.scala:176)
  at org.squeryl.internals.PosoMetaData.<init>(PosoMetaData.scala:39)
  at org.squeryl.View.<init>(View.scala:66)
  at org.squeryl.Table.<init>(Table.scala:29)
  at org.squeryl.Schema$class.table(Schema.scala:340)
  at Library$.table(<console>:22)
  ... 32 elided

scala>

java version
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_80).

what could be the cause for this error??..thanks!!!..

David Whittaker

unread,
Jun 16, 2015, 10:19:50 AM6/16/15
to squ...@googlegroups.com
Hi,

There seem to be some issues with Scala and calling Class.getSimpleName within a REPL session.  See this issue: https://issues.scala-lang.org/browse/SI-2034.  While the title references nested classes, it seems like it can crop up on any class that is defined within the REPL.  Could that possibly be what you're seeing?  Can you try creating your tables outside of the REPL to see if you get a different result?

-Dave

--
You received this message because you are subscribed to the Google Groups "Squeryl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to squeryl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carlo

unread,
Jun 16, 2015, 6:40:07 PM6/16/15
to squ...@googlegroups.com
thanks. it works outside the repl,  weird error, would be nice includes some note in the documentation although it's not a squeryl issue...

I've other small question, I notice than I can define a defaultTo property inside my column definition, I don't know how use it and overpass the strict scala type system, if I define my column as Option[Boolean] for instance, I can't set defaultTo to false because the obvious type mismatch, using null when instanciate also fails, how is the correct way for use defaulTo

thanks!

David Whittaker

unread,
Jun 16, 2015, 7:08:37 PM6/16/15
to squ...@googlegroups.com

The documentation exists as part of the repo on the gh-pages branch: https://github.com/squeryl/squeryl/tree/gh-pages You are welcome to submit a pull request including the note.

To set a default for an Optional field, just wrap it in an option:

on(t)(t => declare (
    t.anOptionalBooleanField.defaultsTo(Option(false))
))

carlo

unread,
Jun 22, 2015, 12:58:42 PM6/22/15
to squ...@googlegroups.com
thanks David, it works...my english is not so good so I prefer don't touch the documentation :D
Reply all
Reply to author
Forward
0 new messages