UUID string - issue with mysql ?

161 views
Skip to first unread message

nazymko....@gmail.com

unread,
Dec 28, 2016, 4:08:40 PM12/28/16
to jOOQ User Group
Hello, jooq users

issue: after creating record in database I'm not able to fetch with dao/select with DSL this record by generated value (generated value from java code )

 Value ' 21ыыыы 2016-12-28 23:05:17ыыыыыы 0000-00-00 00:00:00ыыыыыыыыы 1ыы 1ы"ODk5NTU3M2UtZTc2NC00MTUwLTg1ZDYtZT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ' can not be represented as java.sql.Timestamp



DBMS: mysql 5.7.16-log  / MYSQL community server
jooq: 3.9.0 


table:
CREATE TABLE job
(
    id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
    link VARCHAR(512),
    title VARCHAR(512),
    description LONGTEXT,
    image VARCHAR(1024),
    registered TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
    salary VARCHAR(128),
    slug VARCHAR(512),
    edit_key VARCHAR(38),
    is_remote TINYINT(1),
    owner_email VARCHAR(256),
    is_disabled TINYINT(1) DEFAULT '0',
    updated_at TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL,
    company_name VARCHAR(256),
    company_email VARCHAR(256),
    company_twitter VARCHAR(256),
    job_visible_id VARCHAR(36),
    is_part_tyme TINYINT(1),
    total_views MEDIUMTEXT,
    location VARCHAR(256),
    is_visa_sponsorship TINYINT(1),
    is_relocation_bonuses TINYINT(1),
    is_brand_new_project TINYINT(1),
    is_freelancers_allowed TINYINT(1),
    seniority_level VARCHAR(32),
    registered_user_id BIGINT(20),
    company_id INT(11),
    is_draft TINYINT(4),
    CONSTRAINT job_user_id_fk FOREIGN KEY (registered_user_id) REFERENCES user (id)
);
CREATE UNIQUE INDEX job_edit_key_uindex ON job (edit_key);
CREATE UNIQUE INDEX job_id_uindex ON job (id);
CREATE INDEX job_user_id_fk ON job (registered_user_id);


java code:
....
String jobVisibleId = getJobVisibleId();

createDraft(jobVisibleId, user(session));

checkJob(jobVisibleId, user(session));
...


private void
checkJob(String jobVisibleId, User user) {
try {
jobDao.getJobsDao().fetchByJobVisibleId(jobVisibleId);
} catch (Exception any) {
System.err.println(any.getMessage());
checkJob(changeJobId(jobVisibleId, user), user);
}
}

private String changeJobId(String jobVisibleId, User user) {
String newUuid = new BASE64Encoder().encode(UUID.randomUUID().toString().getBytes()).substring(0, 34);
System.out.println("Updating visible id from " + jobVisibleId + " to " + newUuid);

jobDao.changeVisibleId(newUuid, jobVisibleId);
return newUuid;
}


and there are some logs:
SQL [select `directcontact`.`job`.`id`, `directcontact`.`job`.`link`, `directcontact`.`job`.`title`, `directcontact`.`job`.`description`, `directcontact`.`job`.`image`, `directcontact`.`job`.`registered`, `directcontact`.`job`.`salary`, `directcontact`.`job`.`slug`, `directcontact`.`job`.`edit_key`, `directcontact`.`job`.`is_remote`, `directcontact`.`job`.`owner_email`, `directcontact`.`job`.`is_disabled`, `directcontact`.`job`.`updated_at`, `directcontact`.`job`.`company_name`, `directcontact`.`job`.`company_email`, `directcontact`.`job`.`company_twitter`, `directcontact`.`job`.`is_part_tyme`, `directcontact`.`job`.`total_views`, `directcontact`.`job`.`location`, `directcontact`.`job`.`is_visa_sponsorship`, `directcontact`.`job`.`is_relocation_bonuses`, `directcontact`.`job`.`is_brand_new_project`, `directcontact`.`job`.`is_draft`, `directcontact`.`job`.`is_freelancers_allowed`, `directcontact`.`job`.`seniority_level`, `directcontact`.`job`.`registered_user_id`, `directcontact`.`job`.`company_id`, `directcontact`.`job`.`job_visible_id` from `directcontact`.`job` where `directcontact`.`job`.`job_visible_id` in (?)]; Value ' 21ыыыы 2016-12-28 23:05:17ыыыыыы 0000-00-00 00:00:00ыыыыыыыыы 1ыы 1ы$2be907ed-aae5-4114-a13b-b637f960c1f0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ' can not be represented as java.sql.Timestamp
Updating visible id from 2be907ed-aae5-4114-a13b-b637f960c1f0 to ODk5NTU3M2UtZTc2NC00MTUwLTg1ZDYtZT
SQL [select `directcontact`.`job`.`id`, `directcontact`.`job`.`link`, `directcontact`.`job`.`title`, `directcontact`.`job`.`description`, `directcontact`.`job`.`image`, `directcontact`.`job`.`registered`, `directcontact`.`job`.`salary`, `directcontact`.`job`.`slug`, `directcontact`.`job`.`edit_key`, `directcontact`.`job`.`is_remote`, `directcontact`.`job`.`owner_email`, `directcontact`.`job`.`is_disabled`, `directcontact`.`job`.`updated_at`, `directcontact`.`job`.`company_name`, `directcontact`.`job`.`company_email`, `directcontact`.`job`.`company_twitter`, `directcontact`.`job`.`is_part_tyme`, `directcontact`.`job`.`total_views`, `directcontact`.`job`.`location`, `directcontact`.`job`.`is_visa_sponsorship`, `directcontact`.`job`.`is_relocation_bonuses`, `directcontact`.`job`.`is_brand_new_project`, `directcontact`.`job`.`is_draft`, `directcontact`.`job`.`is_freelancers_allowed`, `directcontact`.`job`.`seniority_level`, `directcontact`.`job`.`registered_user_id`, `directcontact`.`job`.`company_id`, `directcontact`.`job`.`job_visible_id` from `directcontact`.`job` where `directcontact`.`job`.`job_visible_id` in (?)]; Value ' 21ыыыы 2016-12-28 23:05:17ыыыыыы 0000-00-00 00:00:00ыыыыыыыыы 1ыы 1ы"ODk5NTU3M2UtZTc2NC00MTUwLTg1ZDYtZT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ' can not be represented as java.sql.Timestamp
Updating visible id from ODk5NTU3M2UtZTc2NC00MTUwLTg1ZDYtZT to NDAxN2U4YjItZmIxMC00MDliLWE1MDItMT
SQL [select `directcontact`.`job`.`id`, `directcontact`.`job`.`link`, `directcontact`.`job`.`title`, `directcontact`.`job`.`description`, `directcontact`.`job`.`image`, `directcontact`.`job`.`registered`, `directcontact`.`job`.`salary`, `directcontact`.`job`.`slug`, `directcontact`.`job`.`edit_key`, `directcontact`.`job`.`is_remote`, `directcontact`.`job`.`owner_email`, `directcontact`.`job`.`is_disabled`, `directcontact`.`job`.`updated_at`, `directcontact`.`job`.`company_name`, `directcontact`.`job`.`company_email`, `directcontact`.`job`.`company_twitter`, `directcontact`.`job`.`is_part_tyme`, `directcontact`.`job`.`total_views`, `directcontact`.`job`.`location`, `directcontact`.`job`.`is_visa_sponsorship`, `directcontact`.`job`.`is_relocation_bonuses`, `directcontact`.`job`.`is_brand_new_project`, `directcontact`.`job`.`is_draft`, `directcontact`.`job`.`is_freelancers_allowed`, `directcontact`.`job`.`seniority_level`, `directcontact`.`job`.`registered_user_id`, `directcontact`.`job`.`company_id`, `directcontact`.`job`.`job_visible_id` from `directcontact`.`job` where `directcontact`.`job`.`job_visible_id` in (?)]; Value ' 21ыыыы 2016-12-28 23:05:17ыыыыыы 0000-00-00 00:00:00ыыыыыыыыы 1ыы 1ы"NDAxN2U4YjItZmIxMC00MDliLWE1MDItMT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ' can not be represented as java.sql.Timestamp


thankful for any suggestions 


Lukas Eder

unread,
Dec 29, 2016, 12:21:09 PM12/29/16
to jooq...@googlegroups.com
Hi,

Thanks for your enquiry. Here are some ideas:

- Perhaps, your generated code is not in sync with the database, and columns / data types are no longer accurate?
- Where does this error originate? You haven't posted any stack trace...
- Somehow, it looks as though several values are concatenated into one. Might be a JDBC driver bug that doesn't correctly serialise / deserialise your encoded string

Hope this helps,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nazymko....@gmail.com

unread,
Dec 29, 2016, 6:04:36 PM12/29/16
to jOOQ User Group
there is stacktrace
1483052291968                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ' can not be represented as java.sql.Timestamp
at org.jooq_3.9.0.MYSQL.debug(Unknown Source)
at org.jooq_3.9.0.MYSQL.debug(Unknown Source)
at org.jooq.impl.Tools.translate(Tools.java:1981)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:676)
at org.jooq.impl.CursorImpl$CursorIterator.fetchOne(CursorImpl.java:1569)
at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1520)
at org.jooq.impl.CursorImpl.fetch(CursorImpl.java:342)
at org.jooq.impl.CursorImpl.fetch(CursorImpl.java:295)
at org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:289)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:349)
at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:315)
at org.jooq.impl.SelectImpl.fetch(SelectImpl.java:2708)
at org.jooq.impl.DAOImpl.fetch(DAOImpl.java:293)
at io.directcontact.dao.tables.daos.JobDao.fetchByJobVisibleId(JobDao.java:261)
at io.directcontact.mvc.user.PaperController.checkJob(PaperController.java:76)
at io.directcontact.mvc.user.PaperController.createPapers(PaperController.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)

all classes is in up to date state ,

here is Job pojo and record in attach  

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
Job.java
JobRecord.java

nazymko....@gmail.com

unread,
Dec 29, 2016, 6:06:43 PM12/29/16
to jOOQ User Group
reason why it is now contains numbers - I use current time as string to check if it has some restrictions for binary values  
1483052291968                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ' can not be represented as java.sql.Timestamp



On Thursday, December 29, 2016 at 7:21:09 PM UTC+2, Lukas Eder wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

nazymko....@gmail.com

unread,
Dec 29, 2016, 6:31:47 PM12/29/16
to jOOQ User Group, nazymko....@gmail.com
generally I have valid select in SelectImpl :
where `directcontact`.`job`.`job_visible_id` in ('1483053500509')

but when I had to try to read value - in deep-deep code I have found original sql exception, image attached  (I has put 'draft' in most of fields)
Value ' 36 draft draft draft draft 2016-12-30 01:26:06 draft draft$d08cea28-6ca7-4188-875b-6f0b2573ec13 0ы 1 0000-00-00 00:00:00 draft draft draft 0 draft draft 0 0 0 1 0 draft 1ы
1483053966031                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ' can not be represented as java.sql.Timestamp


sql.png

nazymko....@gmail.com

unread,
Dec 29, 2016, 6:41:42 PM12/29/16
to jOOQ User Group, nazymko....@gmail.com
actually.... it is mysql bug.. 

   updated_at TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL,

this should create updated_at with the default value, but  doesn't
after I assign a concrete value for this field - the problem is gone 

Cheers 
Have a nice day!

Lukas Eder

unread,
Dec 30, 2016, 3:03:31 AM12/30/16
to jooq...@googlegroups.com
Hey, thanks for following up. Glad it worked out for you in the end! :)
Cheers,
Lukas

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages