You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Ajay Aggarwal <aa...@covergence.com> on 2007/12/05 22:43:05 UTC

update query syntax for embedded class field

I am trying to update a field of the embedded class using query, but its
not working. In the following code, 'registration' is an embedded class
field inside 'User' and 'authenticated' is a boolean field inside this
embedded class.

 

Query q = em.createQuery("UPDATE User s SET s.registration.authenticated
= :auth");

q.setParameter("auth", false);

 

I am getting following error. What is the correct syntax for such a
query?

 

openjpa.persistence.ArgumentException: An error occurred while parsing
the query filter 'UPDATE User s SET s.registration.authenticated =
:auth'. Error message: <4|false|0.9.7>
org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
character 33, but expected: ["="].

 

Thanks.

 


Re: update query syntax for embedded class field

Posted by Marc Prud'hommeaux <mp...@apache.org>.
I think we might only support setting top-level attributes, but you  
are right: it does look like we are supposed to support navigation  
through an arbitrary number of 1-1 relations.


On Dec 5, 2007, at 2:59 PM, Michael Bouschen wrote:

> Hi Ajay Aggarwal,
>
> I think your query is correct and should work. According to the Java  
> Persistence query language BNF the expression following the keyword  
> SET might be a state_field and state_field includes navigation  
> through an embedded:
> state_field ::= {embedded_class_state_field.}*simple_state_field
>
> I propose you file a JIRA issue.
>
> Regards Michael
>
>> I am trying to update a field of the embedded class using query,  
>> but its
>> not working. In the following code, 'registration' is an embedded  
>> class
>> field inside 'User' and 'authenticated' is a boolean field inside  
>> this
>> embedded class.
>>
>>
>> Query q = em.createQuery("UPDATE User s SET  
>> s.registration.authenticated
>> = :auth");
>>
>> q.setParameter("auth", false);
>>
>>
>> I am getting following error. What is the correct syntax for such a
>> query?
>>
>>
>> openjpa.persistence.ArgumentException: An error occurred while  
>> parsing
>> the query filter 'UPDATE User s SET s.registration.authenticated =
>> :auth'. Error message: <4|false|0.9.7>
>> org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
>> character 33, but expected: ["="].
>>
>>
>> Thanks.
>>
>>
>>
>>
>
>
> -- 
> Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
> Buelowstr. 66                Fax.: +49/(0)30/217 520-12
> 10783 Berlin                 mailto:mbo.tech@spree.de  
> Geschaeftsfuehrung: Anna-Kristin Proefrock
> Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52
>


RE: update query syntax for embedded class field

Posted by Ajay Aggarwal <aa...@covergence.com>.
Jira issue created

https://issues.apache.org/jira/browse/OPENJPA-461


-----Original Message-----
From: Ajay Aggarwal [mailto:aaggarwal@covergence.com] 
Sent: Thursday, December 06, 2007 9:39 AM
To: users@openjpa.apache.org
Subject: RE: update query syntax for embedded class field

Thanks Michael. I will file a bug. 

Meanwhile, is there a workaround for this?

-----Original Message-----
From: Michael Bouschen [mailto:mbo.tech@spree.de] 
Sent: Wednesday, December 05, 2007 5:59 PM
To: users@openjpa.apache.org
Subject: Re: update query syntax for embedded class field

Hi Ajay Aggarwal,

I think your query is correct and should work. According to the Java 
Persistence query language BNF the expression following the keyword SET 
might be a state_field and state_field includes navigation through an 
embedded:
state_field ::= {embedded_class_state_field.}*simple_state_field

I propose you file a JIRA issue.

Regards Michael

> I am trying to update a field of the embedded class using query, but
its
> not working. In the following code, 'registration' is an embedded
class
> field inside 'User' and 'authenticated' is a boolean field inside this
> embedded class.
>
>  
>
> Query q = em.createQuery("UPDATE User s SET
s.registration.authenticated
> = :auth");
>
> q.setParameter("auth", false);
>
>  
>
> I am getting following error. What is the correct syntax for such a
> query?
>
>  
>
> openjpa.persistence.ArgumentException: An error occurred while parsing
> the query filter 'UPDATE User s SET s.registration.authenticated =
> :auth'. Error message: <4|false|0.9.7>
> org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
> character 33, but expected: ["="].
>
>  
>
> Thanks.
>
>  
>
>
>   


-- 
Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
Buelowstr. 66                Fax.: +49/(0)30/217 520-12
10783 Berlin                 mailto:mbo.tech@spree.de 
 
Geschaeftsfuehrung: Anna-Kristin Proefrock
Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52


RE: update query syntax for embedded class field

Posted by Ajay Aggarwal <aa...@covergence.com>.
Hi, I am still looking for a workaround for this issue. Is it possible
to structure the query in some other way to achieve the same results? Or
is my only alternative is to do it in the code? Thanks.

-----Original Message-----
From: Ajay Aggarwal [mailto:aaggarwal@covergence.com] 
Sent: Thursday, December 06, 2007 9:39 AM
To: users@openjpa.apache.org
Subject: RE: update query syntax for embedded class field

Thanks Michael. I will file a bug. 

Meanwhile, is there a workaround for this?

-----Original Message-----
From: Michael Bouschen [mailto:mbo.tech@spree.de] 
Sent: Wednesday, December 05, 2007 5:59 PM
To: users@openjpa.apache.org
Subject: Re: update query syntax for embedded class field

Hi Ajay Aggarwal,

I think your query is correct and should work. According to the Java 
Persistence query language BNF the expression following the keyword SET 
might be a state_field and state_field includes navigation through an 
embedded:
state_field ::= {embedded_class_state_field.}*simple_state_field

I propose you file a JIRA issue.

Regards Michael

> I am trying to update a field of the embedded class using query, but
its
> not working. In the following code, 'registration' is an embedded
class
> field inside 'User' and 'authenticated' is a boolean field inside this
> embedded class.
>
>  
>
> Query q = em.createQuery("UPDATE User s SET
s.registration.authenticated
> = :auth");
>
> q.setParameter("auth", false);
>
>  
>
> I am getting following error. What is the correct syntax for such a
> query?
>
>  
>
> openjpa.persistence.ArgumentException: An error occurred while parsing
> the query filter 'UPDATE User s SET s.registration.authenticated =
> :auth'. Error message: <4|false|0.9.7>
> org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
> character 33, but expected: ["="].
>
>  
>
> Thanks.
>
>  
>
>
>   


-- 
Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
Buelowstr. 66                Fax.: +49/(0)30/217 520-12
10783 Berlin                 mailto:mbo.tech@spree.de 
 
Geschaeftsfuehrung: Anna-Kristin Proefrock
Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52


RE: update query syntax for embedded class field

Posted by Ajay Aggarwal <aa...@covergence.com>.
Thanks Michael. I will file a bug. 

Meanwhile, is there a workaround for this?

-----Original Message-----
From: Michael Bouschen [mailto:mbo.tech@spree.de] 
Sent: Wednesday, December 05, 2007 5:59 PM
To: users@openjpa.apache.org
Subject: Re: update query syntax for embedded class field

Hi Ajay Aggarwal,

I think your query is correct and should work. According to the Java 
Persistence query language BNF the expression following the keyword SET 
might be a state_field and state_field includes navigation through an 
embedded:
state_field ::= {embedded_class_state_field.}*simple_state_field

I propose you file a JIRA issue.

Regards Michael

> I am trying to update a field of the embedded class using query, but
its
> not working. In the following code, 'registration' is an embedded
class
> field inside 'User' and 'authenticated' is a boolean field inside this
> embedded class.
>
>  
>
> Query q = em.createQuery("UPDATE User s SET
s.registration.authenticated
> = :auth");
>
> q.setParameter("auth", false);
>
>  
>
> I am getting following error. What is the correct syntax for such a
> query?
>
>  
>
> openjpa.persistence.ArgumentException: An error occurred while parsing
> the query filter 'UPDATE User s SET s.registration.authenticated =
> :auth'. Error message: <4|false|0.9.7>
> org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
> character 33, but expected: ["="].
>
>  
>
> Thanks.
>
>  
>
>
>   


-- 
Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
Buelowstr. 66                Fax.: +49/(0)30/217 520-12
10783 Berlin                 mailto:mbo.tech@spree.de 
 
Geschaeftsfuehrung: Anna-Kristin Proefrock
Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52


Re: update query syntax for embedded class field

Posted by Michael Bouschen <mb...@spree.de>.
Hi Ajay Aggarwal,

I think your query is correct and should work. According to the Java 
Persistence query language BNF the expression following the keyword SET 
might be a state_field and state_field includes navigation through an 
embedded:
state_field ::= {embedded_class_state_field.}*simple_state_field

I propose you file a JIRA issue.

Regards Michael

> I am trying to update a field of the embedded class using query, but its
> not working. In the following code, 'registration' is an embedded class
> field inside 'User' and 'authenticated' is a boolean field inside this
> embedded class.
>
>  
>
> Query q = em.createQuery("UPDATE User s SET s.registration.authenticated
> = :auth");
>
> q.setParameter("auth", false);
>
>  
>
> I am getting following error. What is the correct syntax for such a
> query?
>
>  
>
> openjpa.persistence.ArgumentException: An error occurred while parsing
> the query filter 'UPDATE User s SET s.registration.authenticated =
> :auth'. Error message: <4|false|0.9.7>
> org.apache.openjpa.kernel.jpql.ParseException: Encountered "." at
> character 33, but expected: ["="].
>
>  
>
> Thanks.
>
>  
>
>
>   


-- 
Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
Buelowstr. 66                Fax.: +49/(0)30/217 520-12
10783 Berlin                 mailto:mbo.tech@spree.de 
 
Geschaeftsfuehrung: Anna-Kristin Proefrock
Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52