Hi i am using
Seam 2.2 , Jboss 6.1, hibernate 3.5.6 and MSQL Server 2008
and have a function like this.
public void deliverFile() {
Code:
EntityManager jobbEntityManager = (EntityManager)Component.getInstance("jobbEntityManager");
JobbStatusInterface jobbStatus = new JobbStatus();
jobbStatus.setStatus(PluginStatus.INITIATED);
jobbEntityManager.persist(jobbStatus);
/**
Code here to save a file that takes a minutes
**/
jobbStatus.setStatus(PluginStatus.DONE);
jobbEntityManager.flush();
}
public void checkJobb(){
EntityManager jobbEntityManager = (EntityManager)Component.getInstance("jobbEntityManager");
jobbEntityManager.createQuery("from JobbStatus", JobbStatus.class).getResultList();
}
i have a poll on checkJobb every 10 seconds so if the deliveryFile() function is executed.
the checkJobb queues upp and stops at the query, so when deliveryFile() functions finishes it finish all 6 checkJobbs() at once.
Even if i select from the database directly it is locked and finishes it's query after deliveryFile() is done.
Is there anyway to solove this so i can do my checkJobb() while deliveryFile is executing?