package io.trygvis; import io.trygvis.model.*; import io.trygvis.queue.*; import org.slf4j.*; import org.springframework.stereotype.*; import org.springframework.transaction.annotation.*; import java.util.*; import javax.persistence.*; import static org.springframework.transaction.annotation.Propagation.*; @Component public class CreateArticleCallable implements AsyncService.AsyncCallable { private final Logger log = LoggerFactory.getLogger(getClass()); @PersistenceContext private EntityManager entityManager; // @Transactional(propagation = REQUIRES_NEW) public void run() throws Exception { log.info("CreateArticeJob.run: BEGIN"); Date now = new Date(); log.info("now = {}", now); Article article = new Article(new Date(), null, "title", "body"); entityManager.persist(article); log.info("CreateArticeJob.run: END"); } }