Re: using webobjects for the first time
Re: using webobjects for the first time
- Subject: Re: using webobjects for the first time
- From: Chuck Hill <email@hidden>
- Date: Sun, 13 Aug 2006 16:07:00 -0700
On Aug 10, 2006, at 11:09 PM, Fleetwood, Brett (DCS) wrote:
G'day,
I've been asked to "enhance" an existing webobjects 5.2 project. My
background is a Java J2EE developer. I've been working on this for
the best part of 2 weeks and find the tools extremely frustrating,
This is an excellent reason to get some training. The task you
describe below is about 5 minutes of work. ;-) I am pretty sure
there are some Aussie companies doing training, talk to Michelle of
http://www.webobjectives.com.au.
(they are old though and makes you appreciate modern IDE's). The
update that i been asked to do is add an extra field to a database
that can then be created/updated/deleted from the front end form.
I'm updating the visitor classes. which, like the employee class,
inherit from Person -> Item -> EOGenericRecord. I've added a
String barcodeNumber to Visitor the same way Employee has a
barCodeNumber. Now, I've added a getter/setter to the visitor
object like so;
public String barCodeNumber() {
return (String)storedValueForKey("barCodeNumber");
}
public void setBarCodeNumber(String value) {
takeStoredValueForKey(value, "barCodeNumber");
}
I then added the reference to this in the WO file...
barCodeNumber: WOString {
value = newVisitor.barCodeNumber;
}
where newVisitor is of type Visitor. I then updated the database,
after spending ages getting the classpath correct for the adapter i
finally got the EOModeller tool to work but when i added the new
barCodeNumber field it wanted to drop the whole table and start
again, so i ran an alter statement to updated the database
manually. I then saved the new attribute in EOModeller so the
visitor.plist and file was updated. Note that the visitor.fspec
file wasn't touched (i'm not sure how this file is used)
the plist file looks like this;
{
allowsNull = Y;
columnName = barCodeNumber;
externalType = varchar;
name = barCodeNumber;
valueClassName = NSString;
width = 10;
},
The application builds and i then deploy and start it through
Monitor. The application runs untill i bring up a page that contains a
<WEBOBJECT NAME=barCodeNumber></WEBOBJECT> directive. it then
throws a run time exception of the following...
Application: pleaseWork
Error: com.webobjects.foundation.NSKeyValueCoding
$UnknownKeyException: takeValueForKey(): attempt to assign value to
unknown key: 'barCodeNumber'. This class does not have an instance
variable of the name barCodeNumber or _barCodeNumber, nor a method
of the name setBarCodeNumber or _setBarCodeNumber
Reason:
Stack trace:
FileLine#MethodPackage
NA : Non applicable, JIT activated
I've been on this for a while and tried to make sense of these set
of development tools, however they seem quite obtuse. Can anyone
please help and tell me where i went wrong. I more the happy to
supply more info if needed. Thank you in advance
This is a build issue. The build is failing or did not happen or you
are using Xcode and it is caching something old. Is the EOModel in a
framework? Did you build and install the framework? Failing that,
close Xcode, and rm -r all the build/ directories and rebuild everthing.
Chuck
--
Coming sometime... - 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