phantom-dsl


Phantom's generated `store` method throws a ClassCastException at runtime


I have the following Phantom table definition:
package myPackage
import com.outworkers.phantom.CassandraTable
import com.outworkers.phantom.connectors.RootConnector
import com.outworkers.phantom.dsl._
import com.outworkers.phantom.keys.{PartitionKey, PrimaryKey}
import scala.concurrent.Future
case class KeysTwoThreeAndFour(myKeyTwo: Int, myKeyThree: String, myKeyFour: Int)
abstract class MyTable extends CassandraTable[MyTable, Int] with RootConnector {
object myKeyOne extends IntColumn(this) with PartitionKey
object myKeyTwo extends IntColumn(this) with PrimaryKey
object myKeyThree extends StringColumn(this) with PrimaryKey
object myKeyFour extends IntColumn(this) with PrimaryKey
object myValue extends IntColumn(this)
def insertValue(myKeyOne: Int, valuesMap: Map[KeysTwoThreeAndFour, Int]): Future[Unit] = {
val resultFutures = for ((key: KeysTwoThreeAndFour, myValue) <- valuesMap) yield {
store(myKeyOne, key.myKeyTwo, key.myKeyThree, key.myKeyFour, myValue).future()
}
Future.sequence(resultFutures).map { _ => () }
}
}
This compiles fine, but at runtime throws the following exception:
java.lang.ClassCastException: scala.Tuple5 cannot be cast to scala.runtime.Nothing$
at myPackage.MyTable$anon$macro$1$1.store(MyTable.scala:10)
at com.outworkers.phantom.CassandraTable.store(CassandraTable.scala:125) ~[com.outworkers.phantom-dsl_2.11-2.7.6.jar:2.7.6]
at myPackage.MyTable$$anonfun$2.apply(MyTable.scala:19)
at myPackage.MyTable$$anonfun$2.apply(MyTable.scala:18)
...
I am following the examples in the bottom of the Phantom table docs, what seems to be the problem? Is the issue perhaps that I have a simple Int as my "Record" type instead of an actual class?
I am using phantom-dsl 2.7.6, Play Framework 2.3.10 and Scala 2.11.11.
Note that the following code works fine:
insert
.value(_.myKeyOne, myKeyOne)
.value(_.myKeyTwo, key.myKeyTwo)
.value(_.myKeyThree, key.myKeyThree)
.value(_.myKeyFour, key.myKeyFour)
.value(_.myValue, myValue)
.future()
Thanks.

Related Links

Phantom's generated `store` method throws a ClassCastException at runtime
Connecting to Cassandra on startup, and monitoring session health
How do I query an optional column with a secondary index using phantom?
How to clean up RootConnector in phantom-dsl?
Phantom Cassandra batch insert

Categories

HOME
sonarqube
fabricjs
azure-stream-analytics
jpa
cobalt
c++11
google-spreadsheet
obfuscation
jsf-2.2
graphics
static-site
entity-framework-core
rds
azure-container-service
frontend
extjs4.2
pattern-matching
32bit-64bit
eip
selectize.js
do-while
esoteric-languages
android-7.0-nougat
soci
sse
nodemcu
delphi-xe5
lilypond
google-maps-autocomplete
simpleitk
kendo-mobile
cgbitmapcontext
dataflow-diagram
parcelable
joptionpane
mount
expressionengine3
asymptotic-complexity
has-and-belongs-to-many
paperjs
iis-express
boost-asio
eviews
aws-codecommit
postback
jett
dsx-desktop
sammy.js
biztalk-rule-engine
android-maps-extensions
fiware-cygnus
google-knowledge-graph
nohup
filesystemwatcher
sim-card
metawidget
opensmpp
doc
vmware-fusion
softmax
drupal-theming
apache-directory
rfc3339
httr
getchar
nanoc
term
hammer.js
azure-cli
bbpress
django-1.10
ampps
branch-prediction
dotnetnuke-7
refinerycms
android-wake-lock
database-relations
crouton-os
include-guards
poppler
rubaxa-sortable
mirror
botan
mass-assignment
uncaught-typeerror
structuremap3
named-parameters
ss7
file-not-found
extjs2
multiautocompletetextview
qscrollarea
drupal-nodes
rfc5322
android-usb
ora-06550
artemis
tlf
merb
mysql-error-2013
device-width
frameworkelementfactory
jquery-blockui
boost-msm
multiplexing
node-redis
filemerge
drawtobitmap
w3c-geolocation
dataform
django-paypal
codebase
interop-domino
lemmatization
commercial-application
netbeans6.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App