Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 874104

Summary: Human-task queries for JPA2 seem to fail.
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Marco Rietveld <mrietvel>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: CLOSED UPSTREAM QA Contact: Marek Baluch <mbaluch>
Severity: high Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.1   
Target Milestone: ER4   
Target Release: BRMS 5.3.1 GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Some human task queries were not updated to be aligned with both JPA1 (Hibernate3) and JPA2 (Hibernate4), as a result of this tests were failing and some of the functionality was not available with JPA2 (Hibernate4). This has been resolved by ensuring all queries are aligned to work with both JPA1 and JPA2. Complete functionality is now available on both JPA1 and JPA2.
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:21:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test log for human-task tests under hib4 / jpa2 / h2
none
Test log for TaskServiceTest with Mysql / HIb4 / JPA2
none
Test log for TaskServiceTest with Postgresql / HIb4 / JPA2
none
test case for query TasksByStatusByProcessIdByTaskName none

Description Marco Rietveld 2012-11-07 14:00:50 UTC
Created attachment 640092 [details]
Test log for human-task tests under hib4 / jpa2 / h2

Description of problem:

When running the human-task tests against

- Hibernate 4 / JPA 2
- H2 database

The following tests fail: 

testCompleteTaskByProcessInstanceId(org.jbpm.task.service.test.TaskServiceTest)
testCompleteTaskByProcessInstanceIdTaskname(org.jbpm.task.service.test.TaskServiceTest)

Version-Release number of selected component (if applicable):


How reproducible:

Every time. 

Steps to Reproduce:
1. Run the Hib4H2PackagingTest.runTestsUnderHibernate4Jpa2H2() test
  
Actual results:

The tests fail with the errors shown in the attachment. 


Expected results:

No failures of the tests (just like what happens when running the tests under Hib3 / JPA 1 and H2. )

Additional info:

Comment 1 Marco Rietveld 2012-11-07 15:11:59 UTC
Created attachment 640138 [details]
Test log for TaskServiceTest with Mysql / HIb4 / JPA2

Comment 2 Maciej Swiderski 2012-11-07 17:29:29 UTC
problem with failing tests for hibernate4/JPA2 is due to Taskorm-JPA2.xml that is used for JPA2 tests was not updated with latest commit that introduced new queries (BZ-871899), same goes for Taskorm-JPA2.xml used for building EE6 human task server war.
Moreover when reviewing Taskorm.xml files it turned out that main one did not have all queries updated to be aligned with hibernate4

pull request prepared: https://github.com/droolsjbpm/jbpm/pull/143

Comment 3 Marco Rietveld 2012-11-07 20:51:46 UTC
Created attachment 640337 [details]
Test log for TaskServiceTest with Postgresql / HIb4 / JPA2

The fix almost works -- it works for mysql and H2, but not for postgresql. See attached log.

Comment 5 Maciej Swiderski 2012-11-08 15:03:34 UTC
fix merged into 5.2.x branch

please see doc_text for details and important note for posgresql data base. If more details is needed please let me know.

Comment 6 Maciej Swiderski 2012-11-08 17:16:42 UTC
setting this back to assigned as oracle has same issue and could be even more difficult to solve

Comment 7 Maciej Swiderski 2012-11-09 16:59:58 UTC
due to lob limitations in many data bases (can't be used as condition in where clause) a dedicated column (shortText) for I18NText was provided that will hold shorter version (up to 256 characters) of the main text and will be used when searching as it is regular varchar column and not lob.

Comment 8 Jiri Svitak 2012-11-15 14:53:56 UTC
Created attachment 645708 [details]
test case for query TasksByStatusByProcessIdByTaskName

I have tested this and the following query (TasksByStatusByProcessIdByTaskName) fails with JPA2 on MySQL 5.5 (MySQL5Dialect):

Running com.sample.GetTasksByProcessIdTest
1    15/11 15:46:03,091[main] ERROR hibernate.internal.SessionFactoryImpl.<init>  - HHH000177: Error in named query: TasksByStatusByProcessIdByTaskName
org.hibernate.QueryException: could not resolve property: shortText of: org.jbpm.task.I18NText [select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from org.jbpm.task.Task t left join t.taskData.actualOwner as actualOwner left join t.taskData.createdBy as createdBy left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.processInstanceId = :processInstanceId and name.shortText = :taskName and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status) and t.taskData.expirationTime is null]

I have attached a standalone reproducer. Steps to reproduce:
1.) You need to have local MySQL database jdbc:mysql://localhost:3306/brms and user brms, password brms. I used MySQL 5.5.23.
2.) Unzip and run the attached test case. Maven command:
mvn clean test -Dtest=GetTasksByProcessIdTest

Setting the state back to ASSIGNED.

Comment 9 Jiri Svitak 2012-11-15 16:56:18 UTC
Taking back the previous comment. After investigation together with Maciej I was able to discover mistake on my side. Our maven policy is "update never", so my ER4 artifacts were not updated even if they were rebuilded by productization. After solving this I was able to run my test case without problems.

Verified in BRMS 5.3.1 ER4.

Comment 18 Red Hat Bugzilla 2025-02-10 03:21:05 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.