Re: EOModeler : NSTimestamp - Factory Method / Conversion Method
Re: EOModeler : NSTimestamp - Factory Method / Conversion Method
- Subject: Re: EOModeler : NSTimestamp - Factory Method / Conversion Method
- From: lists <email@hidden>
- Date: Tue, 2 Sep 2003 22:41:56 +0200
Thanks to both of you (chuck and jonathan). I changed my internal data
type back to 'date' and now it works like a charm. My dates and times
are fine. I suppose, yesterday as i was working on solving this
problem, i must have changed several things at the same time and drawn
the wrong conclusions.
I believe, it was the coloumn named value class (obj-c) that got me on
the wrong track. Because once i changed the internal type to 'date',
that coloumn changes to NSCalenderDate, which i assumed was wrong,
because in my code i used NSTimestamp. So without using the inspector
i typed NSTimestamp into that coloumn, which set internal type to
'custom' and left my Factory and Conversion Method blank. At the same
time, i changed the coloumns of my database (mysql by the way) from
date to datetime .... and so i ended up with assuming that date
wouldn't store the time.
Is the coloumn 'class (obj-c)' of any importance when working with
java?
thanks again, it's good to have someone who knows how things are
supposed to work.
your happy webobjects-dev-list-user
couzteau
Am Dienstag, 02.09.03, um 21:31 Uhr (Europe/Berlin) schrieb Jonathan
Rochkind:
This stuff is confusing, it's true. You sometimes need to play with it
a little to get it to work for you, with your specific database.
You might want to try setting the under-documented 'value type' column
in EOModeler. See:
http://developer.apple.com/documentation/WebObjects/UsingEOModeler/
4WorkingWithAttributes/chapter_4_section_3.html#//apple_ref/doc/uid/
DontLinkBookID_468-DontLinkChapterID_4-BABFGECE
You could try the various 'value type' options listed for a Date type.
For me, simply setting the internal type to 'Date' works fine, and
stores both date and time information. If it doesn't for you, maybe
playing with the value type will fix things. If it still doesn't
work... I'd normally say, gee, what a pain, it's possible you need to
write a custom JDBCPlugIn for your database, and/or a EODatabase
delegate, in order to get things to work. (What DB are you using? Is
it one Apple officially supports? If so, it really really ought to
just work).
But.... in this case, it appears you've found a workaround.
Custom/NSTimestamp instead of Date. If it really does work fine, then
if it were me, I'd just do that, and ignore EOModeler's complaining.
EOModeler is complaining becuase normally with a Custom internal type,
you've got to provide methods to translate from that custom type to
raw data. I'm not sure why it's working for you the way you are doing
it. I suppose the downside of just continuing to do what you are
doing, is that it could break in a future version of WO, since it's
not really the intended use. But I don't really understand what's
going on.
--Jonathan
At 09:12 PM 9/2/2003 +0200, lists wrote:
Am Dienstag, 02.09.03, um 20:57 Uhr (Europe/Berlin) schrieb Jonathan
Rochkind:
Hm, I've never had that problem. Do you have the internal type of
the attribute set to "Date"? You probably should. It sounds like
you have it set to "Custom" with a class name of "NSTimestamp"
instead---and the factory method and conversion method are blank. A
custom internal type shouldn't be neccesary---"Date" should work
fine.
first of all thank you for your quick reply.
yes, you're right, my internal datatype is 'custom' and the class
attribute of the internal datatype is 'NSTimestamp'. I changed it
from date to that setting because my database records that i created
with 'date' contained nothing but the date, but not the times. so i
assumed that the date setting does what it says: it stores the date,
while a timestamp contains more information. I might be wrong, and
the reason for the times disappearing using 'date' lies somewhere
else.
so with this setting i'm getting the results that i want but
EOModeler is complaining. Being a newbie it renders me uncertain. i
assume, i'm doing something wrong, when a warning appears. that's why
i'm asking.
There's probably a way to get 'Custom' to work, but I don't know
what it is. On the other hand, if everything IS working, maybe
you've already found the way to get it to work, it's just confusing
EOModeler. There are worse things than confusing EOModeler, as long
as everything still works at deployment. But internal type of
'Date' is probably the way to go.
--Jonathan
At 08:35 PM 9/2/2003 +0200, you wrote:
Hello list,
i'm just starting to program WO and i'm really exited. Here's
something that the Docs didn't cover: I'm Using NSTimestamps on the
WOApp-side and DATETIME on the database-side to model my creation
and modification dates of my records (rows) in my database.
Actually storing and retrieving data works fine, but:
EOModeler complains when saving the model that Factory and
Conversion Methods of my datestoring rows are undefined (which is
true). I don't know what to enter in order to make it stop
complaining.
can somebody explain?
thank you very much
_______________________________________________
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.
::: jochen Hagenstroem
::: www.hagenstrom.de
::: email@hidden
::: hamburg, germany
_______________________________________________
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.