openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Judes Tumuhairwe" <judethecuted...@gmail.com>
Subject Re: named query
Date Tue, 18 Nov 2008 18:11:04 GMT
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
<Hakon.Sagehaug@bccs.uib.no>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)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message