You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@label("trip")
case class TripModel(tripId: Option[String] = None,
name: String,
createdDate: Date = new Date(),
startDate: Date,
duration: Int,
totalAdults: Int,
totalChildrens: Int,
@underlying vertex: Option[Vertex] = None
)
I am able to persist a trip model using the following code..
val trip = TripModel(tripId = Some(randomUUID.toString), name = ctr.tripName,
startDate = DateUtil.convertStringToDate(ctr.startTo), duration = ctr.totalDays,
totalAdults = ctr.totalAdults, totalChildrens = ctr.totalChildren, createdDate = new Date())
val tripVertex = graph + trip
However upon retrieval of the persisted vertex I always receive this error.
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[ClassCastException: java.time.Instant cannot be cast to java.util.Date]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:251)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:178)
at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:363)
at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:361)
at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:413)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
Caused by: java.lang.ClassCastException: java.time.Instant cannot be cast to java.util.Date
at service.TripService$$anon$1.toCC(TripService.scala:30)
at service.TripService$$anon$1.toCC(TripService.scala:30)
at gremlin.scala.ScalaVertex.toCC(ScalaVertex.scala:12)
at service.TripService.getTrip(TripService.scala:30)
at controllers.trip.TripController.$anonfun$getTrip$1(TripController.scala:28)
at play.api.mvc.ActionBuilder.$anonfun$apply$11(Action.scala:363)
at scala.Function1.$anonfun$andThen$1(Function1.scala:52)
at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:482)
at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:480)
at play.api.mvc.ActionBuilder$$anon$9.invokeBlock(Action.scala:331)
The text was updated successfully, but these errors were encountered:
Hard to tell without a simple executable example, but looks like some class in the middle instantiates an Instant and not a Date. Here's a simple example that works:
import gremlin.scala._
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
case class CCWithDate(d: java.util.Date)
val graph = TinkerGraph.open.asScala
val cc = CCWithDate(new java.util.Date)
val v = graph + cc
println(v.toCC[CCWithDate])
Here's a snippet of my code
I am able to persist a trip model using the following code..
However upon retrieval of the persisted vertex I always receive this error.
The text was updated successfully, but these errors were encountered: