Hi
It did not seem to do the trick, but I'm a little confused, since it's
working fine when I just have it in a simple client, and not in a web
service. Also if I create the query like this
Query query = getEm().createQuery(
"SELECT w FROM WorkflowInstance w where w.workflowId=:input");
query.setParameter("input", new Integer(workflowId));
Inside my dao implementation and not from a named query I get this exception
An error occurred while parsing the query filter "SELECT w FROM
WorkflowInstance w where w.workflowId=:input". Error message: The name
"WorkflowInstance" is not a recognized entity or identifier. Known entity
names: []
But I've got WorkflowInstance in my persistent.xml like this
<class>no.uib.bccs.esysbio.datastore.provenance.domain.WorkflowInstance</class>
So, any more tips?
cheers, håkon
2008/11/18 Judes Tumuhairwe <[EMAIL PROTECTED]>
> Hi Håkon,
> I don't think you can have variables in annotations, even if it is static
> and final (I think it has to do with the order of processing in different
> JVMs).
>
> Instead of
> @NamedQuery(name = WorkflowInstance.GET_ALL_WORKFLOW_BY_ID, ....)
>
> try
> @NamedQuery(name = "WorkflowInstance.getAllInstancesByWorkflowId", ....)
> and let me know if it works.
>
> thanks,
>
> Judes Tumuhairwe
> Software Developer
> Ford Motor Company (Detroit)
>
> On Tue, Nov 18, 2008 at 4:17 AM, Håkon Sagehaug
> <[EMAIL PROTECTED]>wrote:
>
> > Hi all,
> >
> > i've got a named query like this
> >
> > @NamedQuery(name = WorkflowInstance.GET_ALL_WORKFLOW_BY_ID, query =
> "SELECT
> > w FROM WorkflowInstance w where w.workflowId=:input ORDER BY
> > w.workflowInstanceId")
> >
> > My enity looks like this
> >
> > @Entity
> > @Table(name = "workflowinstance")
> >
> > public class WorkflowInstance implements Serializable {
> >
> > public static final String GET_ALL_WORKFLOW_BY_ID =
> > "getAllInstancesByWorkflowId";
> > public static final String GET_INPUT_OUTPUT_DATA =
> "getInputOutputData";
> >
> > @Id
> > @GeneratedValue()
> >
> > ...
> >
> >
> > }
> >
> > Defined in a entity, when I invoke it form a standalone program it works
> > fine, but when I invoke it through a web service I always get this error
> >
> > "There is no query with the name "getAllInstancesByWorkflowId" defined
> for
> > any of the known persistent classes: null. "
> >
> > As you can see I've defined a constant that hold the value to the name of
> > the query. I can get a single instance of this class without any
> problems,
> > but when I want to write my own query I cant get any results..
> >
> > So I'm wondering what I'm doing wrong here, id the name query correct?
> >
> > cheers, Håkon
> > --
> > Håkon Sagehaug, Software Developer
> > Parallab, Bergen Center for Computational Science (BCCS)
> > UNIFOB AS (University of Bergen Research Company)
> >
>
--
Håkon Sagehaug, Software Developer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)