[Design of JBoss jBPM] - Should HibernateSaveOperation be saveOrUpdate?
by brittm
I've noticed (accidentally of course, -ahem-) that if you attempt to call jbpmContext.save(processInstance) on a pi that was loaded outside of the current session, Hibernate will save a new pi with a new Id--however it will reference the same rootToken, etc. as the original pi, and all kinds of unexpected behavior quietly ensues.
Of course, loading a fresh copy of the pi immediately before you do anything with it avoids the problem; however, a lot of serious data integrity hangs on remembering to do that every time. (for instance, when a pi being viewed in a UI is injected into an action component, the programmer must remember to load up a fresh copy before working on it.)
Since failing to re-load a detached pi can result in what seems to be a broken jBPM data model, jBPM should probably be doing something itself to avoid the problem.
I think there are possibly two ways to prevent this from happening:
1) Simply changing the HibernateSaveOperation.save(processInstance) method to saveOrUpdate() seems to perform cleanly.
| 2) Do a check on the pi, and throw an error if it doesn't belong to the current hibernate session.
|
|
| I did a forum/jira search on saveOrUpdate and didn't come up with anything recognizable, so unless someone shows that I'm just missing something here, I'll create a jira issue for this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118350#4118350
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118350
18 years, 2 months
[Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBM 2.0 destination config.
by timfox
"ataylor" wrote : ok, so we're on the same page.
|
| What I plan to do is have some sort of QueueSettingsRepository that can be used to find a property, i.e.
|
| | queueSettingsRepository.getRedeliveryDelay("queues.testQueue");
| |
| This means we can simplify ManagedDestination, removing all these properties. In fact theyre removed they'll be a simple wrapper and we can get rid completely.
|
| Security will be handled the same.
I currently (uncommitted) have a QueueFactory class.
This is used by the postoffice when it needs to create a queue
| public interface QueueFactory
| {
| Queue createQueue(long id, String name, Filter filter,
| boolean clustered, boolean durable, boolean temporary);
| }
|
|
The idea is the QueueFactory implementation applies the correct settings to the queue depending on the config in queues.xml, and return the correctly configured queue.
If you want to take charge of this you could provide the QueueFactory implementation, currently my skeletion version basically doesn't apply any settings
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118343#4118343
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118343
18 years, 2 months