This is getting ugly.
import java.lang.Integer
type T = InsertValuesStep2[AuthorRecord, Integer, String, String]
authors.fold(create.insertInto(AUTHOR, AUTHOR.ID, AUTHOR.FIRST_NAME,
AUTHOR.LAST_NAME)) {
(q: T, a: Author) => q.values(a.id: Integer, a.firstName, a.lastName)
}
And I'd really like to use the "set" style methods, in which case working
with the DSL types becomes a huge mess.
On Monday, May 20, 2013 2:36:39 AM UTC-4, Danko Sedin wrote:
>
> Hi!
>
> You could try :
> ((authors.fold(create.insertInto(AUTHOR,AUTHOR.ID, AUTHOR.FIRST_NAME,
> AUTHOR.LAST_NAME)))(insertValues, value=> insertValues.values(value.id,
> value.firstName, value.lastName))).execute
>
>
>
> On Mon, May 20, 2013 at 8:24 AM, Christopher Martin
> <[email protected]<javascript:>
> > wrote:
>
>> The docs give a lot of examples for doing INSERTs with some fixed number
>> of tuples, such as:
>>
>> create.insertInto(AUTHOR,
>>> AUTHOR.ID, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
>>> .values(100, "Hermann", "Hesse")
>>> .values(101, "Alfred", "Döblin");
>>
>>
>> But what about the case where I have some arbitrary-length collection of
>> objects? Say for instance I'm using a class
>>
>> case class Author(id: Int, firstName: String, lastName: String)
>>
>>
>> And I now have a Seq[Author] and want to insert them all in one query.
>> How would you go about writing that?
>>
>> --
>> 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] <javascript:>.
>> 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.