openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: [jira] Updated: (OPENJPA-1116) Annotation Strategy not working
Date Wed, 03 Jun 2009 14:36:24 GMT

Hi,
  Thank you for locating this issue. 

   Is it only with relationship fields? what if a field of  basic type is
annotated with @Strategy? 

   I will review the patch and apply it if necessary.

 

JIRA jira@apache.org wrote:
> 
> 
>      [
> https://issues.apache.org/jira/browse/OPENJPA-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> 
> Ashish Paliwal updated OPENJPA-1116:
> ------------------------------------
> 
>     Attachment: OPENJPA-1116-2.0.0(2).patch
>                 OPENJPA-1116-2.0.0.patch
>                 testStrategyAnnotation.jar
> 
> The test case along with my InnerJoinStrategy and persistent entities
> person and Address.
> 2 Patches:
> First for the dummy test case which I created to check the @strategy
> annotation, 
> Second for the suggested change in AnnotationPersistenceMappingParser
> class.
> 
>> Annotation Strategy not working
>> -------------------------------
>>
>>                 Key: OPENJPA-1116
>>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1116
>>             Project: OpenJPA
>>          Issue Type: Bug
>>          Components: jdbc
>>    Affects Versions: 2.0.0
>>         Environment: Windows XP,  openjpa-2.0.0 source code
>>            Reporter: Ashish Paliwal
>>         Attachments: OPENJPA-1116-2.0.0(2).patch,
>> OPENJPA-1116-2.0.0.patch, testStrategyAnnotation.jar
>>
>>
>> I had 2 entities, Person and Address where person had id, age, name and
>> address_id and person had id and city.
>> I tried to apply the Strategy on Address so that  upon execution of JPQL
>> query "Select p from Person p" the SQL query fired should make Inner Join
>> rather than the default Left Outer Join.
>> I created a Strategy class InnerJoinStrategy that makes sure this happens 
>> by overriding the selectEagerJoin() method and gave @Strategy(value =
>> "somepackage.InnerJoinStrategy" ) in Person class before getAddress()
>> method.
>> But unexpectedly, it was still making the LeftOuterJoin rather than the
>> desired InnerJoin. Upon debugging I found that my strategy was never
>> being called. I debugged further and found that in
>> AnnotationPersistenceMappingParser class in
>> parseMemberMappingAnnotations() method, for the case STRAT( which belongs
>> to the Strategy annotation) the strategy value was being set in
>> ValueMappingInfo, while from RuntimeStrategyInstaller it was being
>> fetched from FieldMappingInfo. I changed the code to set it in
>> FieldMappingInfo and everything worked fine. 
> 
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 
> 


-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/-jira--Created%3A-%28OPENJPA-1116%29-Annotation-Strategy-not-working-tp3018275p3018651.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message