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 <g.alexan...@symaris.com>

> 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      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
>
> https://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com
>
> This email sent to alexis.t...@gmail.com
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to