Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse DATETIME error #4

Closed
esteban-gutierrez opened this issue May 20, 2016 · 2 comments
Closed

Parse DATETIME error #4

esteban-gutierrez opened this issue May 20, 2016 · 2 comments
Labels

Comments

@esteban-gutierrez
Copy link

Hello, Stephan:

First of all, thanks for sharing this project, it's great.
I simply noticed when running the application that there was a minor bug when trying to insert the users:

2016-05-20 10:52:51.939 INFO 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 2016-05-20 10:52:51.970 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (1, 'admin', '$2a$08$lDnHPz7eUkSi6ao14Twuau08mzhWrL4kyZGGU5xfiGALO/Vxd5DOi', 'admin', 'admin', 1, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) 2016-05-20 10:52:51.970 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Error interpretando "01-JAN-2016" Error parsing "01-JAN-2016"; SQL statement: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (1, 'admin', '$2a$08$lDnHPz7eUkSi6ao14Twuau08mzhWrL4kyZGGU5xfiGALO/Vxd5DOi', 'admin', 'admin', 1, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) [90014-191] 2016-05-20 10:52:51.971 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (2, 'user', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 1, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) 2016-05-20 10:52:51.971 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Error interpretando "01-JAN-2016" Error parsing "01-JAN-2016"; SQL statement: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (2, 'user', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 1, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) [90014-191] 2016-05-20 10:52:51.972 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (3, 'disabled', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 0, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) 2016-05-20 10:52:51.972 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Error interpretando "01-JAN-2016" Error parsing "01-JAN-2016"; SQL statement: INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (3, 'disabled', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 0, PARSEDATETIME('01-JAN-2016','dd-MMM-yyyy')) [90014-191] 2016-05-20 10:52:51.979 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 1) 2016-05-20 10:52:51.980 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Violación de una restricción de Integridad Referencial: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (1)" Referential integrity constraint violation: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (1)"; SQL statement: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 1) [23506-191] 2016-05-20 10:52:51.985 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 2) 2016-05-20 10:52:51.985 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Violación de una restricción de Integridad Referencial: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (1)" Referential integrity constraint violation: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (1)"; SQL statement: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (1, 2) [23506-191] 2016-05-20 10:52:51.986 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (2, 1) 2016-05-20 10:52:51.986 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Violación de una restricción de Integridad Referencial: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (2)" Referential integrity constraint violation: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (2)"; SQL statement: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (2, 1) [23506-191] 2016-05-20 10:52:51.987 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000388: Unsuccessful: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (3, 1) 2016-05-20 10:52:51.987 ERROR 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : Violación de una restricción de Integridad Referencial: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (3)" Referential integrity constraint violation: "FK_5LOSSCGU02YAEJ7PRAP7O6G5S: PUBLIC.USER_AUTHORITY FOREIGN KEY(USER_ID) REFERENCES PUBLIC.USER(ID) (3)"; SQL statement: INSERT INTO USER_AUTHORITY (USER_ID, AUTHORITY_ID) VALUES (3, 1) [23506-191] 2016-05-20 10:52:51.987 INFO 42707 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete

I simply modified the first 3 SQL statements in the file 'import.sql' to use a valid DATE format:

INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (1, 'admin', '$2a$08$lDnHPz7eUkSi6ao14Twuau08mzhWrL4kyZGGU5xfiGALO/Vxd5DOi', 'admin', 'admin', 1, PARSEDATETIME('01-01-2016','dd-MM-yyyy')); INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (2, 'user', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 1, PARSEDATETIME('01-01-2016','dd-MM-yyyy')); INSERT INTO USER (ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, ENABLED, LASTPASSWORDRESETDATE) VALUES (3, 'disabled', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC', 'user', 'user', 0, PARSEDATETIME('01-01-2016','dd-MM-yyyy'));

...and it worked fine, so then I was able to check the authorization for the three users.

Thanks again and good job!

@gigenthomas
Copy link

Hello Stephan,
Again nice work !! How are you encrypting the passwords ? I would like to create additional users.

GT

szerhusenBC added a commit that referenced this issue May 23, 2016
@szerhusenBC
Copy link
Owner

Thank you both for your positive feedbacks!

@estebangm81 thanks for providing your fix! I've merged it right now.

@gigenthomas I will mention it in the readme section.

luiz158 pushed a commit to luiz158/jwt-spring-security-demo that referenced this issue Feb 1, 2020
…oken_factory

szerhusenBC#1 extract some functionality from TokenFactory.java to JwtAuthentica…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants