Author: chris.laprun(a)jboss.com
Date: 2008-02-08 04:07:20 -0500 (Fri, 08 Feb 2008)
New Revision: 9864
Modified:
tags/JBoss_Portal_2_6_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
Log:
- JBPORTAL-1877: Changed strategy to avoid problems with transactions (seems like the
merge wasn't working properly under some circumstances).
- Order consumer based on the producer name instead of id.
Modified:
tags/JBoss_Portal_2_6_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
---
tags/JBoss_Portal_2_6_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2008-02-08
09:06:06 UTC (rev 9863)
+++
tags/JBoss_Portal_2_6_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2008-02-08
09:07:20 UTC (rev 9864)
@@ -235,19 +235,15 @@
{
// Retrieve the previous id of the given ProducerInfo to update local consumers
map if needed
- String oldId = null;
- ProducerInfo old = (ProducerInfo)session.get(ProducerInfo.class,
producerInfo.getKey());
- if (old != null)
+ String oldId = (String)session.createQuery("select pi.persistentId from
ProducerInfo pi where pi.id = :key")
+ .setParameter("key", producerInfo.getKey()).uniqueResult();
+ if (producerInfo.getId().equals(oldId))
{
- oldId = old.getId();
- if (producerInfo.getId().equals(oldId))
- {
- oldId = null; // reset oldId as the ProducerInfo's id hasn't been
modified
- }
+ oldId = null; // reset oldId as the ProducerInfo's id hasn't been
modified
}
// merge old producer info with new data
- session.merge(producerInfo);
+ session.update(producerInfo);
// if we updated and oldId is not null, we need to update the local consumers
map
if (oldId != null)
@@ -272,7 +268,7 @@
Session session = sessionFactory.getCurrentSession();
- Iterator producerInfos = session.createQuery("from ProducerInfo pi order by
pi.id").iterate();
+ Iterator producerInfos = session.createQuery("from ProducerInfo pi order by
pi.persistentId").iterate();
// load the configured producers
ProducerInfo producerInfo;