Hi all,
I'm working on JOnAS and Tomcat and a workflow engine called Shark, I use Hibernate 2.1, PostgreSQL 7.3 and encounter a strange problem.
I think that is possible it comes from me, but I can't figure out where.
1)First thing is :
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
at java.util.HashMap$ValueIterator.next(HashMap.java:812)
at net.sf.hibernate.impl.Printer.toString(Printer.java:82)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2228)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1732)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1499)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at net.sf.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:507)
at org.enhydra.shark.instancepersistence.HibernatePersistentManager.getPersistedActivityObject(HibernatePersistentManager.java:1126)
at org.enhydra.shark.instancepersistence.HibernatePersistentManager.getAllValidAssignmentsForResource(HibernatePersistentManager.java:1838)
at org.enhydra.shark.WfResourceImpl.getAssignmentsMap(WfResourceImpl.java:120)
at org.enhydra.shark.WfResourceImpl.getAssignment(WfResourceImpl.java:144)
at org.enhydra.shark.SharkUtilities.getAssignment(SharkUtilities.java:770)
at org.enhydra.shark.WfAssignmentWrapper.getAssignmentImpl(WfAssignmentWrapper.java:252)
at org.enhydra.shark.WfAssignmentWrapper.get_accepted_status(WfAssignmentWrapper.java:214)
at org.enhydra.shark.WfAssignmentWrapper.get_accepted_status(WfAssignmentWrapper.java:189)
at ManualTest.run(ManualTest.java:55)
Mapping for this part is :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!-- Hibernate Instance Persistent layer mapping definition file
author Vladislav Pernin-->
<hibernate-mapping>
<class name="org.enhydra.shark.instancepersistence.HibernateActivity" table="activities">
<id name="dbId">
<column name="iddb" not-null="true"/>
<generator class="assigned"/>
</id>
<property name="idAct" type="string" access="field">
<column name="id" not-null="true"/>
</property>
<property name="activityDefinitionId">
<column name="activitydefinitionid" not-null="true"/>
</property>
<property name = "processId">
<column name="process" not-null="true"/>
</property>
<property name = "resourceUsername">
<column name="theresource"/>
</property>
<property name = "stateId">
<column name="state" not-null="true"/>
</property>
<property name="blockActivityId">
<column name="blockactivity"/>
</property>
<property name="name">
<column name="name"/>
</property>
<property name="description">
<column name="description"/>
</property>
<property name="priority">
<column name="priority"/>
</property>
<property name="lastStateTime">
<column name="laststatetime"/>
</property>
<property name="accepted" access="field">
<column name="accepted"/>
</property>
<property name="activated" access="field">
<column name="activated"/>
</property>
</class>
Code is :
private HibernateActivity getPersistedActivityObject(String actId, SharkTransaction ti) throws PersistenceException {
try {
for (Iterator it = ((SharkHibernateTransaction)ti).iterator4type("class org.enhydra.shark.instancepersistence.HibernateActivity");
it.hasNext();) {
HibernateActivity hibActivity = (HibernateActivity)it.next();
if (actId.equals(hibActivity.getId()))
return hibActivity;
}
Session s = ((SharkHibernateTransaction)ti).getSession();
Query qActivity = s.createQuery("from HibernateActivity activity where activity.idAct = :keyValueParam");
qActivity.setString("keyValueParam", actId);
HibernateActivity hibActivity = (HibernateActivity) qActivity.uniqueResult();
((SharkHibernateTransaction)ti).read(hibActivity);
return hibActivity;
} catch (Throwable t) {
throw new PersistenceException(t);
}
}
The problem appears at the line where call to uniqueResult is done.
2)Second problem, is related:
net.sf.hibernate.AssertionFailure: Hibernate has a bug processing collections
at net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate(SessionImpl.java:2821)
at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2774)
at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32)
at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69)
at net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:36)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2474)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2207)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1732)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1499)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at net.sf.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:507)
at org.enhydra.shark.instancepersistence.HibernatePersistentManager.getProcessRequesterByActId(HibernatePersistentManager.java:1071)
at org.enhydra.shark.instancepersistence.HibernatePersistentManager.restore(HibernatePersistentManager.java:557)
at org.enhydra.shark.instancepersistence.HibernatePersistentManager.getAllValidAssignmentsForResource(HibernatePersistentManager.java:1838)
Code is :
private HibernateProcessRequester getProcessRequesterByActId(String actId,SharkTransaction ti) throws PersistenceException {
try {
for (Iterator it = ((SharkHibernateTransaction)ti).iterator4type("class org.enhydra.shark.instancepersistence.Hibernat
eProcessRequester");
it.hasNext();) {
HibernateProcessRequester hibProcessRequester = (HibernateProcessRequester)it.next();
if (actId.equals(hibProcessRequester.getActRequester()))
return hibProcessRequester;
}
Session s = ((SharkHibernateTransaction)ti).getSession();
Query qProcessRequesterQuery = s.createQuery("from HibernateProcessRequester processRequester where processRequester.actRequester = :keyValueParam");
qProcessRequesterQuery.setString("keyValueParam", actId);
HibernateProcessRequester hibProcessRequester = (HibernateProcessRequester) qProcessRequesterQuery.uniqueResult();
((SharkHibernateTransaction)ti).read(hibProcessRequester);
return hibProcessRequester;
}
catch (Throwable t) {
throw new PersistenceException(t);
}
}
And mappings :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!-- Hibernate Instance Persistent layer mapping definition file
author Vladislav Pernin-->
<hibernate-mapping>
<class name="org.enhydra.shark.instancepersistence.HibernateProcessRequester" table="processrequesters">
<id name="dbId">
<column name="iddb" not-null="true"/>
<generator class="assigned"/>
</id>
<property name="idPro" type="string" access="field">
<column name="id" not-null="true"/>
</property>
<property name="actRequester">
<column name="activityrequester"/>
</property>
<property name="resRequester">
<column name="resourcerequester"/>
</property>
</class>
</hibernate-mapping>
Help would be really helpful on this one.
Thanks
Vlad
|