简体   繁体   中英

diverging implicit expansion in implicit val GetResult

Using slick and following the examples, I have created a implicit val to convert my result like this:

implicit val getLocationResult = GetResult(r => LkpLocation(r.<<, r.<<, r.<<, r.<<))
val marketsQuery1 = sql"exec get_locations @ProjectId = ${projectID.get}, @ObjectId = $objectID, @ComponentTypeID = 1".as[LkpLocation]

However I get a strange error message:

diverging implicit expansion for type scala.slick.jdbc.GetResult[T] starting with method createGetTuple22 in object GetResult

What is the cause of this error? Is there perhaps another way I can declare the implicit conversion that would be more stable?

Ensure the class you're converting to contains only types slick's PositionedResult can handle using it's << method. For a list of all types see the other methods of PositionedResult.

I got this error when using a java.util.Date on my target class while PositionedResult's method nextDate returns a java.sql.Date. Declaring the target class's date field as java.sql.Date then solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM