Hi Naneon, my guess is that your entities mapping your views have no primary key defined (i'm not sure it's even allowed)... or the primary key defined is not one (not unique)
Cheers Alex Le 9 juin 2011 à 11:00, [email protected] a écrit : > Hi All, > > I create a view to get all data I want and do a fetch on WO to return > specific data. So When I create my fetching code, the sqlExpression is good > but return same data several times although it count different data. > I.e : > > Java fetch code: NSMutableArray<EOQualifier> qualFinal = new > NSMutableArray<EOQualifier>(); > NSMutableArray<String> qualFi = new NSMutableArray<String>(); > qualFi.add("110"); > qualFi.add("120"); > NSArray DiplOrderings = new NSArray(new Object[]{ > > EOSortOrdering.sortOrderingWithKey(DilplomeSpec.DIPL_SPEC_C_KEY,EOSortOrdering.CompareAscending), > > EOSortOrdering.sortOrderingWithKey(DilplomeSpec.DIPLOME_C_KEY,EOSortOrdering.CompareAscending)}); > EOQualifier qualING2 = EOQualifier.qualifierWithQualifierFormat( > "diplomeC = %@", new NSArray<String>("ING2")); > EOQualifier qualING2a = > EOQualifier.qualifierWithQualifierFormat( > "diplSpecC <> %@ AND diplSpecC <> %@", new > NSArray<String>(qualFi)); > qualFinal.add(qualING2); > qualFinal.add(qualING2a); > EOQualifier ingenieux = new EOAndQualifier(qualFinal); > EOQualifier qualMST = EOQualifier.qualifierWithQualifierFormat( > "diplomeC = %@", new NSArray<String>("MST")); > //Liste des spécialité Ingénieur > > sessionFr.setIngenieurs(DilplomeSpec.fetchDilplomeSpecs(session().defaultEditingContext(), > ingenieux, DiplOrderings)); > for (int i=0; i <sessionFr.getIngenieurs().count(); i++){ > DilplomeSpec ing = > sessionFr.getIngenieurs().objectAtIndex(i); > NSLog.out.appendln(ing.descFr()); > } > //Liste des spécialités master > > sessionFr.setMasters(DilplomeSpec.fetchDilplomeSpecs(session().defaultEditingContext(), > qualMST, DiplOrderings)); > for (int i=0; i <sessionFr.getMasters().count(); i++){ > DilplomeSpec mst = > sessionFr.getMasters().objectAtIndex(i); > NSLog.out.appendln(mst.descFr()); > } > > Result in Log : > > 2327 [WorkerThread0] DEBUG NSLog - evaluateExpression: > <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "SELECT > t0.DESC_EN, t0.DESC_FR, t0.DIPL_SPEC_C, t0.DIPLOME_C FROM > GERRY.V_DIPSPEC_PRDDEF t0 WHERE (t0.DIPLOME_C = ? AND (t0.DIPL_SPEC_C <> ? > AND t0.DIPL_SPEC_C <> ?)) ORDER BY t0.DIPL_SPEC_C ASC, t0.DIPLOME_C ASC" > withBindings: 1:"ING2"(diplomeC), 2:"110"(diplSpecC), 3:"120"(diplSpecC)> > 2460 [WorkerThread0] DEBUG NSLog - 6 row(s) processed > 2461 [WorkerThread0] DEBUG NSLog - === Commit Internal Transaction > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] INFO NSLog - Systèmes d'Information et de > Télécommunications (SIT) > 2480 [WorkerThread0] DEBUG NSLog - === Begin Internal Transaction > 2480 [WorkerThread0] DEBUG NSLog - evaluateExpression: > <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "SELECT > t0.DESC_EN, t0.DESC_FR, t0.DIPL_SPEC_C, t0.DIPLOME_C FROM > GERRY.V_DIPSPEC_PRDDEF t0 WHERE t0.DIPLOME_C = ? ORDER BY t0.DIPL_SPEC_C ASC, > t0.DIPLOME_C ASC" withBindings: 1:"MST"(diplomeC)> > 2485 [WorkerThread0] DEBUG NSLog - 4 row(s) processed > 2486 [WorkerThread0] DEBUG NSLog - === Commit Internal Transaction > 2486 [WorkerThread0] INFO NSLog - Convention Master (CV MAST) > 2486 [WorkerThread0] INFO NSLog - Convention Master (CV MAST) > 2486 [WorkerThread0] INFO NSLog - Convention Master (CV MAST) > 2486 [WorkerThread0] INFO NSLog - Convention Master (CV MAST) > > When I excecute this SQL Expression in SqlDeveloper I have this result : > > Expression 1 : SELECT t0.DESC_EN, t0.DESC_FR, t0.DIPL_SPEC_C, t0.DIPLOME_C > FROM GERRY.V_DIPSPEC_PRDDEF t0 WHERE (t0.DIPLOME_C = 'ING2' AND > (t0.DIPL_SPEC_C <> '110' AND t0.DIPL_SPEC_C <> '120')) ORDER BY > t0.DIPL_SPEC_C ASC, t0.DIPLOME_C ASC; > > Result : > "DESC_EN" > "DESC_FR" > "DIPL_SPEC_C" "DIPLOME_C" > 1-"Information Systems and telecommunications (SIT)" "Systmes d'Information > et de Tlcommunications (SIT)" "121" "ING2" > 2-"Industrial Systems (SI)" "Systmes Industriels (SI)" "122" "ING2" > 3-"Mechanical Systems (SM)" "Systmes Mcaniques (SM)" "123" "ING2" > 4-"Materials Science and Technology (MTE)" "Matriaux : Technologie et > Economie (MTE)" "124" "ING2" > 5-"Informatique et Systmes d'Information (ISI)" "Informatique et > Systmes d'Information (ISI)" "125" "ING2" > 6-"Systmes, Rseaux et Tlcommunications (SRT)" "Systmes, Rseaux et > Tlcommunications (SRT)" "126" "ING2" > > Expression 2 : SELECT t0.DESC_EN, t0.DESC_FR, t0.DIPL_SPEC_C, t0.DIPLOME_C > FROM GERRY.V_DIPSPEC_PRDDEF t0 WHERE t0.DIPLOME_C = 'MST' ORDER BY > t0.DIPL_SPEC_C ASC, t0.DIPLOME_C ASC; > > "DESC_EN" > "DESC_FR" "DIPL_SPEC_C" "DIPLOME_C" > 1-"Convention Master (CV MAST)" "Convention Master (CV MAST)" "70" > "MST" > 2-"Mcanique et Physique (MP)" "Mcanique et Physique (MP)" "781" > "MST" > 3-"Sciences et Technologies de l'information et de la communication (STIC)" > "Sciences et Technologies de l'information et de la communication (STIC)" > "782" "MST" > 4-"Ingnierie et management (IM)" "Ingnierie et management (IM)" "783" > "MST" > > > My Question is Why WO return the same data and How to fix it? > > Thanks for all > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com > > This email sent to [email protected]
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
