• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne


  • Subject: Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne
  • From: "g.alexandre" <email@hidden>
  • Date: Thu, 19 Apr 2012 08:18:37 +0200

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@hidden>
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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne (From: "g.alexandre" <email@hidden>)
 >Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne (From: Alexis Tual <email@hidden>)

  • Prev by Date: Re: Entity Modeler, attributes default value for migrations
  • Next by Date: A problem with http request to a webobjects site
  • Previous by thread: Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne
  • Next by thread: Re: java.lang.ClassCastException: com.webobjects.eocontrol.EOGenericRecord cannot be cast to com.cariatides.noyau.modele.noyauppersonne.Personne
  • Index(es):
    • Date
    • Thread