thanks, i test your answer but i already have the same problem, if i extends ERXGenericRecord, i have " java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to er.extensions.eof.ERXEnterpriseObject " and when i extends EOGenericRecords he say my fields is null and don't return a person. have you an other idea? Le 19 avr. 2012 à 01:20, Alexis Tual a écrit :
> Hi, > > you should put the whole stacktrace in there. > A note, your eos should inherits from EOGenericRecord (or better, > ERXGenericRecord, use the templates from Wonder : > http://wiki.wocommunity.org/display/WOL/EOGenerator+Templates+and+Additions) > > Alex > > 2012/4/19 g.alexandre <[email protected]> > hi, > When i execute my test methods with java, i have : > java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord > cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne > But my class personne extends EOCustomObject so i don't know why i have this > error. When i inspect listeResultat.objectAtIndex(0), i have a person but i > don't cast it. > > public void test() { > NSArray entryList; > ERXExtensions.initApp(your.app.Application.class, new String[0]); > EOEditingContext editingContext = new EOEditingContext(); > entryList = EOUtilities.rawRowsForSQL(editingContext, "MaTable", > "select count(*) from MaTable", null); > Personne p = Personne.rechercherParNip(editingContext, 9793l); > System.out.println(p); > System.out.println(entryList); > } > > > public static Personne rechercherParNip(EOEditingContext editingContexte, > Long critereNip, boolean refetch) { > EOKeyValueQualifier qualifieur = null; > EOFetchSpecification specification = null; > NSArray listeResultat = null; > Personne resultat = null; > > try { > qualifieur = new EOKeyValueQualifier("nip", > EOQualifier.QualifierOperatorEqual, critereNip); > specification = new EOFetchSpecification("Personne", qualifieur, > null); > //specification.setRefreshesRefetchedObjects(refetch); > listeResultat = > editingContexte.objectsWithFetchSpecification(specification); > if ((null != listeResultat) && (1 == listeResultat.count())) { > resultat = (Patient) listeResultat.objectAtIndex(0); > } > } catch (Exception exception) { > System.out.println("Personne.rechercherParNip(....) : "); > System.out.println(exception.toString()); > resultat = null; > } > return resultat; > } > > > Best regards G.ALEXANDRE > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > https://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: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
