if you use persistence you should make it as part of transaction and to do so you could use command like following:
String nodeName = ksession.execute(new GenericCommand<String>() {
public String execute(Context context) {
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
org.jbpm.process.instance.ProcessInstance processInstance = (org.jbpm.process.instance.ProcessInstance) ksession.getProcessInstance(piId);
return ((org.jbpm.workflow.instance.WorkflowProcessInstance)instance).getNodeInstances().iterator().next().getNodeName());
}
});
Obviously it's simple case you could have a command that does all you need.
if you are looking for a way to get node names of active process instance you can use history log data for it and then you don't need to have anything else but processInstanceId, take a look at methods of this class
HTH