good day all,
I am running 2 program on separate JVM on the same server. both use hibernate to access the database. It seems that program1 always wait for program2 's database access complete and continue, or vice versa. It looks like sequential execution.
I guess it's something wrong with my code. anyone can help me with it?
below is the hibernate util class
import org.hibernate.*;
import org.hibernate.cfg.*;
public class HibernateUtil {
private static SessionFactory sessionFactory; static { try { sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { throw new RuntimeException (ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
public static ArticleType createArticleType(String description) { ArticleType ArticleType = new ArticleType(); ArticleType.setDescription(description); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.save(ArticleType); session.getTransaction().commit(); return ArticleType; }