Re: Default mysql TIMESTAMPS not allowed NULL
Re: Default mysql TIMESTAMPS not allowed NULL
- Subject: Re: Default mysql TIMESTAMPS not allowed NULL
- From: John Pollard via Webobjects-dev <email@hidden>
- Date: Thu, 12 Nov 2020 09:10:28 +0000
Thank you Tim and Ray,
Just moved to Mac OS 10.15.7 in development which has given me the headaches
I have installed the latest mysql 8.0.22
Java 8 (I use Java Web Start which keeps me on 8 for now)
As my production system is on mysql 5, I found I had to use
mysql-connector-java-5.1.44 which currently keeps both environments happy with
regards establishing the connection. So this may be the issue.
I will plan to upgrade mysql in production and get everything in line, I just
don’t want to do too much all in one hit.
So for now I will go down one of the coding routes, perhaps just set it in
validateXXX() for each entity.
Thanks for the more generic coding options Tim which I will also look at.
John
> On 12 Nov 2020, at 02:09, Ray Kiddy <email@hidden> wrote:
>
> I was seeing the same at one point. I believe that upgrading the jdbc driver
> I was using fixed it. What version of the jdbc driver jar are you using? I am
> using mysql-connector-java-8.0.19.jar.
>
> % java --version
> java 14 2020-03-17
> Java(TM) SE Runtime Environment (build 14+36-1461)
> Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)
>
> My system version is: macOS 10.15.4 (19E287)
>
> What are you trying to work with?
>
> cheers - ray
>
>
> On 11/11/20 3:13 PM, Tim W via Webobjects-dev wrote:
>> John:
>>
>> Off the top of my head these may be a couple options:
>>
>> 1. In your EO super class, override willInsert or awakeFromInsertion. The
>> former assumes you’re extending ERXGenericRecord. Not so elegant but you
>> could clobber every instance of a certain attribute type - with some
>> overhead.
>> 2. Possibly override MySQLExpression.formatValueForAttribute ? Force what
>> you want when a certain attribute type is null. Maybe poll for the version
>> of mysql there?
>>
>> Tim
>> UCLA GSE&IS
>>
>>> On Nov 11, 2020, at 2:20 PM, John Pollard via Webobjects-dev
>>> <email@hidden> wrote:
>>>
>>> Hi again list,
>>>
>>> My move to Catalina forced me to mysql 8. The previous version allowed NULL
>>> to be passed to TIMESTAMP fields causing mysql to set them automatically,
>>> but the NULL passed in the INSERT statements causes an error.
>>>
>>> From reading around I believe they should be passed as a blank “” rather
>>> than NULL in order for mysql to default them. I should update my Wonder
>>> snapshot as perhaps it is fixed in Wonder now, but I am wary of making too
>>> many changes all at once. The lesson I suppose is to keep all aspects
>>> reasonably up to date in good time!
>>>
>>> Is there a quick way to set all fields that are of type
>>> dateTimeStampPrototype in the EOModel to be blank rather than NULL? Or I
>>> could just set them to now in code, but is there one place I can do it
>>> rather than in every entity class?
>>>
>>> Thanks
>>> John
>>>
_______________________________________________
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