Search in sources :

Example 1 with TweetUser

use of com.querydsl.example.sql.model.TweetUser in project querydsl by querydsl.

the class TweetRepository method save.

@Transactional
public Long save(Tweet tweet, Long... mentions) {
    Long tweetId = save(tweet);
    SQLInsertClause insert = insert(tweetUser);
    for (Long mentionsId : mentions) {
        TweetUser tu = new TweetUser();
        tu.setTweetId(tweetId);
        tu.setMentionsId(mentionsId);
        insert.populate(tu).addBatch();
    }
    insert.execute();
    return tweetId;
}
Also used : TweetUser(com.querydsl.example.sql.model.TweetUser) SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) Transactional(com.querydsl.example.sql.guice.Transactional)

Aggregations

Transactional (com.querydsl.example.sql.guice.Transactional)1 TweetUser (com.querydsl.example.sql.model.TweetUser)1 SQLInsertClause (com.querydsl.sql.dml.SQLInsertClause)1