openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Håkon Sagehaug" <Hakon.Sageh...@bccs.uib.no>
Subject Re: named query
Date Wed, 19 Nov 2008 14:11:50 GMT
Hi all

My issue was that the web sevice/server was not able to see the jar that I
had with my entity files. I had my jar containing the entities inside my web
service archive file, then I moved it to the to level apache-tomcat library
with my other openjpa jar and dependency, then all worked fine.

cheers, Håkon

2008/11/19 Håkon Sagehaug <Hakon.Sagehaug@bccs.uib.no>

> 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 <judethecutedude@gmail.com>
>
> 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)
>> >
>>
>
>
>
> --
> 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)

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