• 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: Beginners question... objectsMatchingKeyAndValue not working as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginners question... objectsMatchingKeyAndValue not working as expected


  • Subject: Re: Beginners question... objectsMatchingKeyAndValue not working as expected
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 14 Apr 2006 10:31:32 -0700


On Apr 14, 2006, at 10:06 AM, Tarun Reddy wrote:

This is what is in my VaultUser.plist file (inside of WOVault.eo)

    attributes = (
        {
            columnName = LOGIN;
            externalType = CHAR;

There is your problem. CHAR is fixed width. So if login is "Tarun", it will only match if followed by 35 spaces. Change the external type to varchar (variable length char) and regenerate the database.

Chuck


            name = login;
            valueClassName = NSString;
            width = 40;
        },
        {
            columnName = PASSWORD;
            externalType = CHAR;
            name = password;
            valueClassName = NSString;
            width = 40;
        },
        {
            columnName = "USER_OID";
            externalType = NUMBER;
            name = userOid;
            valueClassName = NSNumber;
            valueType = d;
        }
    );


I believe that the login attribute is 'login'. I tried changing it to something else and I get an error when running the application, so I think I have it correct.


Tarun

On Apr 14, 2006, at 11:02 AM, Ken Anderson wrote:

Is the login attribute 'login', or something else? You need the attribute name from the model here, not the database column name.

That's all I can think of at this point!

Ken

On Apr 14, 2006, at 12:58 PM, Tarun Reddy wrote:

So I've been hanging out in the J2EE world for a while, all the time looking at WebObjects. Finally came up with a little self project that I thought would be nice to implement in WebObjects, so I'm jumping in.

However I'm currently having an issue with retrieving objects from the database. Here is a sample sniplet that shows what I'm trying to do:

// allow user to log in
Session session = (Session)session();
EOEditingContext ec = session.defaultEditingContext();
System.out.println(login);
NSArray users = EOUtilities.objectsMatchingKeyAndValue (ec, "VaultUser", "login", login);
// NSArray users = EOUtilities.objectsForEntityNamed(ec, "VaultUser");




Now, the second commented line works, but the first doesn't even though I have a row in the database where the login column is equal to the value that "login" is.

Any ideas? I'm stumped. (BTW, I actually took this code from one of Apple's demo applications, iShack, I think)

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


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:
40global-village.net


This email sent to email@hidden

--
Coming in late 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ 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
  • Follow-Ups:
    • Re: Beginners question... objectsMatchingKeyAndValue not working as expected
      • From: Tarun Reddy <email@hidden>
References: 
 >Beginners question... objectsMatchingKeyAndValue not working as expected (From: Tarun Reddy <email@hidden>)
 >Re: Beginners question... objectsMatchingKeyAndValue not working as expected (From: Ken Anderson <email@hidden>)
 >Re: Beginners question... objectsMatchingKeyAndValue not working as expected (From: Tarun Reddy <email@hidden>)

  • Prev by Date: Re: Beginners question... objectsMatchingKeyAndValue not working as expected
  • Next by Date: Re: Beginners question... objectsMatchingKeyAndValue not working as expected
  • Previous by thread: Re: Beginners question... objectsMatchingKeyAndValue not working as expected
  • Next by thread: Re: Beginners question... objectsMatchingKeyAndValue not working as expected
  • Index(es):
    • Date
    • Thread