totally stumped..
totally stumped..
- Subject: totally stumped..
- From: James Cicenia <email@hidden>
- Date: Sat, 19 Jun 2004 09:21:18 -0500
Hello all -
I am trying to import records via an EXCEL cvs file. I found a great
java class utility at
http://ostermiller.org/utils/doc/ for doing this. This part works fine
as it populates my
array and variable perfectly.
Now the problems:
In my loop I need to populate my main Project object with some
relationships, so in
order to do this I first need to check if they exist or not... if not
create them otherwise
find it and return it. Here is a typical example for a resource:
In this example for some reason it will add duplicate entries?! Since
it is coming from
the same text file this should only give me on entry and then the
remaining it should just
return it.
I am doing my final ec.saveChanges() in my loop after everything is set
and then onto the
next record, etc. Why would this code not trap the duplicates?
I have been spending way tooo many hours on this import. Should be a
piece of cake compared
to everything else I have done... but it just won't work.
Thanks.. hopefully if I can understand this bug, I could then maybe
understand why my code
is not assigning the main Project object a new unique row_id.. it is
giving it a zero.
thanks again
James
private PortfolioResource getResource(EOEditingContext ec, Portfolio
portfolio, String fName, String lName){
System.out.println("in Get Resource");
PortfolioResource thisResource;
NSMutableDictionary criteria = new NSMutableDictionary();
criteria.setObjectForKey(portfolio, "portfolio");
criteria.setObjectForKey(fName, "firstName");
criteria.setObjectForKey(lName, "lastName");
try {
thisResource = (PortfolioResource)
EOUtilities.objectMatchingValues(ec,"PortfolioResource",criteria);
} catch (EOUtilities.MoreThanOneException e1) {
System.err.println(
"ERROR: more than one exists!!! of PortfolioResource");
throw new ValidationException("Please contact a System
Administrator.");
} catch (EOObjectNotAvailableException e2) {
System.out.println("in New Resource");
PortfolioResource theNewResource = new PortfolioResource();
ec.insertObject(theNewResource);
theNewResource.setFirstName(fName);
theNewResource.setLastName(lName);
theNewResource.setPortfolio(portfolio);
theNewResource.setAddDate(new NSTimestamp());
theNewResource.setLastModDate(new NSTimestamp());
//ec.saveChanges();
return theNewResource;
}
return thisResource;
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.