-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Beginner needs help with a JOIN
PostPosted: Wed Jul 23, 2008 4:51 am 
Newbie

Joined: Wed Feb 14, 2007 4:49 am
Posts: 7
Hi all !
I'm trying to fetch records from a JBPM application (which uses hibernate to map classes). The join I need to do is

Code:
String sql= "from TaskInstance t, ProcessInstance p " +
                 "where t.id = p.id order by p.id desc";


It's a simple join between the ID of TaskInstance and ProcessInstance.

However The query delivers an error:
10:48:12,640 ERROR [STDERR] org.hibernate.hql.ast.QuerySyntaxException: org.jbpm.taskmgmt.exe.ProcessInstance is not mapped [from org.jbpm.taskmgmt.exe.TaskInstance t, org.jbpm.taskmgmt.exe.ProcessInstance p where t.id = p.id order by p.id
desc]


What's wrong with the query ?

Ehm sorry to raise another issue about it, but what kind of Object will this Query return ? Without the join

Code:
String sql= "from TaskInstance t order by t.id desc";


I get a List of TaskInstance objects, but with a join what kind of Object will be created in the List ? TaskInstance or ProcessInstance ? both ?

Thanks a lot for your help
Francesco


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2008 5:26 am 
Newbie

Joined: Tue Jul 22, 2008 6:37 am
Posts: 3
> What's wrong with the query ?

It might be some problems in how did you map org.jbpm.taskmgmt.exe.ProcessInstance. It is not a problem of the query. But the query look really strange. It is joined by primary id's of both classes, you know it is quite unusual and might be a bug. Anyway in a hibernate it is better to join by using mapping properties. Something like this:


Code:
from TaskInstance t inner join t.processInstance p order by p.id desc


> but what kind of Object will this Query return ?

Upd.

This is wrong:
-- It will return objects of instance TaskInstance in both cases. ---

This is a quote from the book:

"A Cartesian product allows you to retrieve all possible combinations of instances of two or more classes. This query returns all ordered pairs of Users and Category objects:
Code:
from User, Category

Obviously, this generally isn’t useful. There is one case where it’s commonly used: theta-style joins."

So I suppose it will return List of Object[] where element at index 0 will be of the class TaskInstance and element at index 1 will be of the class ProcessInstance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 24, 2008 4:11 am 
Newbie

Joined: Wed Feb 14, 2007 4:49 am
Posts: 7
thanks for your reply.
I'm, sorry I made a silly mistake: ProcessInstance doesn't belong to org.jbpm.taskmgmt.exe package but to org.jbpm.graph.exe.
Correcting the package it works
Thanks
francesco


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.