Interesting, thanks for sharing! That Scala implicit magic...
So I guess if there's a Scala fix to be made soon, I won't integrate this
in jOOQ-Scala


2013/9/27 Rob Nikander <[email protected]>

> I posted my question to a scala mailing list. Someone suggested it was
> related to a known issue in the compiler, which may be fixed soon. [1]
>
> In the meantime, I'll share the following, which you can import once, and
> it solves my original problem. I have a second one for UpdateStep. In
> effect it adds another set method to the InsertSetStep class.
>
>   class FixedInsertStep[R <: Record](step: InsertSetStep[R]) {
>     // JT = jooq/java type. ST = scala type
>     // Allows set to work when there is an implicit conversion from ST to
> JT
>     def set[JT, ST](field: org.jooq.Field[JT], scalaThing: ST)(implicitconv: 
> ST => JT): InsertSetMoreStep[R] = step.set[JT](field,
> conv(scalaThing))
>   }
>   implicit def insertStep2Fixed[R <: Record](step: InsertSetStep[R]):
> FixedInsertStep[R] = new FixedInsertStep(step)
>
> Rob
>
> [1] https://groups.google.com/forum/#!topic/scala-language/g2XHmM7vOl0
>
> On Monday, September 23, 2013 4:34:35 PM UTC-4, Lukas Eder wrote:
>
>> Thanks for the update. I wonder if converting Field[Integer] to
>> Field[Int] might do the trick? I.e. MODIFIED_BY.asInstanceOf[**Field[Int]].
>> Due to Java's generic type erasure, this might actually work (even if it
>> wouldn't work in pure Scala). Of course, this is a hack. A better solution
>> might be to use  set(..., value(i))
>>
>> I've been talking to a Scala committer tonight. In the long run, an
>> actual Scala API seems for a robust jOOQ integration into Scala...
>>
>> 2013/9/23 Rob Nikander <[email protected]>
>>
>>>
>>>
>>> On Monday, September 23, 2013 4:35:05 AM UTC-4, Lukas Eder wrote:
>>>>
>>>>
>>>> This is indeed weird. From my intuitive (and far from thorough)
>>>> understanding, the Scala compiler should infer [T] from the first method
>>>> argument, just like the Java compile does. But I wouldn't be surprised if
>>>> this behaviour differs significantly, as soon as implicit conversions
>>>> apply. Are you using org.jooq.scala.Conversions? What would happen to this
>>>> statement, if you removed it? In particular these conversions:
>>>>
>>>
>>> I removed my import of Conversions._, but it had no effect. It does
>>> infer it when the types match perfectly. If I find out why the implicit
>>> int2Integer is not applied, I'll post an update here. If I can help it,
>>> I don't want to use the more verbose: set[Integer](...), or set(...,
>>> int2Integer(i)).
>>>
>>> Rob
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jOOQ User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jooq-user+...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to