私はsimple-reactを使用しています。
内部LazyFutureStream
では、エンティティを永続化したいと考えています。
LazyFutureStream.parallel(1,2,3,4,5)
.map(id -> {
try {
SessionFactory sessionFactory = Application.getHibernateBundle()
.getSessionFactory();
ManagedSessionContext.bind(sessionFactory.openSession());
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
Model model = new Model(sessionFactory);
model.persist(id);
session.getTransaction().commit();
}
});
これは正しいです ?すべてのスレッドのセッション ファクトリの作成をスキップする方法はありますか。
また、上記では、フォークしたいだけで、参加したくありません。それでいいですか?