[jboss-user] [JBoss jBPM] - Re: flush database

gnagy do-not-reply at jboss.com
Wed Jul 30 12:02:43 EDT 2008


Hi Ronald,

Well, I hope you'll find time to visit us anyway. Then again, there is always next year! 

We found a solution to the problem. It's brute, but works. Basically, before, we dropped the whole jbpm database, and then restarted jboss as, thereby recreating all tables again. Then, I noticed which tables were empty after a fresh start, and now we just empty those tables when needed. Here is the code:


		for(String table: new String[] {"jbpm_db.jbpm_bytearray", "jbpm_db.jbpm_byteblock", "jbpm_db.jbpm_comment", "jbpm_db.jbpm_decisionconditions", "jbpm_db.jbpm_exceptionhandler", "jbpm_db.jbpm_job", "jbpm_db.jbpm_log", "jbpm_db.jbpm_moduleinstance", "jbpm_db.jbpm_pooledactor", "jbpm_db.jbpm_processinstance", "jbpm_db.jbpm_runtimeaction", "jbpm_db.jbpm_swimlaneinstance", "jbpm_db.jbpm_taskactorpool", "jbpm_db.jbpm_taskcontroller", "jbpm_db.jbpm_taskinstance", "jbpm_db.jbpm_token", "jbpm_db.jbpm_tokenvariablemap", "jbpm_db.jbpm_variableaccess", "jbpm_db.jbpm_variableinstance"}) {
			DbUtils.emptyTable(em, table);
		}

and in DBUtils.java:
	public static void emptyTable(EntityManager em, String tableName) {
		Query query = em.createNativeQuery("delete from " + tableName);
		query.executeUpdate();
	}

Luckily we didn't run into foreign key integrity issues.

We really need to remove all process data from the jbpm database, since we also empty  our domain database, and any references to our domain model in jbpm will not be valid anymore.

Thanks for the suggestion, and good luck with your startup! I hope it will be fun :)
Greg

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4167674#4167674

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4167674



More information about the jboss-user mailing list