openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2160) jest findcommand compound/composite primary keys
Date Tue, 09 Oct 2012 18:26:03 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee updated OPENJPA-2160:
--------------------------------

    Fix Version/s:     (was: 2.2.0)
                   2.3.0
    
> jest findcommand compound/composite primary keys
> ------------------------------------------------
>
>                 Key: OPENJPA-2160
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2160
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.2.0
>            Reporter: Herman Vierendeels
>            Priority: Minor
>             Fix For: 2.3.0
>
>         Attachments: findcommand.diff
>
>
> jest find command with compound/composite primary key
> http://localhost:8080/openjpa_jest/jest/find/format=json?type=FAKTUREN&FBJ=2012&FNR=4
> diff
> 23d22
> < import java.lang.reflect.Modifier;
> 31d29
> < import java.util.Set;
> 33d30
> < import org.apache.openjpa.enhance.PCRegistry;
> 36d32
> < import org.apache.openjpa.meta.FieldMetaData;
> 39,40d34
> < import org.apache.openjpa.util.ObjectId;
> < import org.apache.openjpa.lib.log.Log;
> 78,82c72,74
> <         Object[] keys_obj=parameters.keySet().toArray();
> <         FieldMetaData[] fmds=meta.getPrimaryKeyFields();
> <         if(fmds.length!=parameters.size())
> <         {
> <          throw new ProcessingException(ctx,new Exception("number of primaryKeys
"+fmds.length+" differs from number of arguments "+parameters.size()));
> ---
> >         Iterator<Map.Entry<String,String>> params = parameters.entrySet().iterator();
> >         for (int i = 0; i < parameters.size(); i++) {
> >             pks[i] = params.next().getKey();
> 84,104d75
> <         for(int i=0;i<fmds.length;i++)
> <         {
> <          FieldMetaData fmd=fmds[i];
> <          String shrtnm=fmd.getName();
> <          int idx=fmd.getIndex();
> <          boolean prmsContainName=parameters.containsKey(shrtnm);
> <          if(prmsContainName)
> <          {
> <           String prm_val=parameters.get(shrtnm);
> <           pks[i]=prm_val;
> <           ctx.log(Log.INFO,"tshvr4 FindCommand process setting pks "+i+" shrtnm="+shrtnm+"
to "+prm_val);
> <          }
> <          else
> <          {
> <           pks[i]=keys_obj[i];
> <           if(i>0)
> <           {
> <            throw new ProcessingException(ctx,new Exception("if more than 1 primaryKey
parm value,primaryKey parm value should be coded as primaryKeyField=primaryKeyValue because
arguments are collected into map which does not respect sequence"));
> <           }
> <          }
> <         }        
> 106,109d76
> <         if(oid instanceof ObjectId)
> <         {
> <          oid=((ObjectId)oid).getIdObject();
> <         }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message