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

[improve] use eclipselink orm replace of hibernate orm #1801

Merged
merged 20 commits into from
Apr 23, 2024

Conversation

tomsun28
Copy link
Contributor

What's changed?

use eclipselink orm replace of hibernate orm, due hibernate core licenses is lgpl.

eclipselink is another implement for jpa guide

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has checked 2149 files.

Valid Invalid Ignored Fixed
861 2 1286 0
Click to see the invalid file list
  • common/src/main/java/org/apache/hertzbeat/common/config/EclipseLinkCustomizer.java
  • common/src/main/java/org/apache/hertzbeat/common/config/EclipseLinkJpaConfiguration.java
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

tomsun28 and others added 4 commits April 21, 2024 15:49
…eLinkCustomizer.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
…eLinkJpaConfiguration.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28
Copy link
Contributor Author

fatal error, eclipselink auto create some table failed but no log 😂

@tomsun28
Copy link
Contributor Author

[EL Finest]: ddl: 2024-04-22 17:40:41.325--Thread(Thread[main,5,main])--The table (hzb_notice_template) could not be created due to exception:
Internal Exception: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "CREATE TABLE hzb_notice_template (ID BIGINT [*]IDENTITY NOT NULL, CONTENT LONGVARCHAR, CREATOR VARCHAR, GMTCREATE TIMESTAMP, GMTUPDATE TIMESTAMP, MODIFIER VARCHAR, NAME VARCHAR, PRESET boolean default false, TYPE SMALLINT, PRIMARY KEY (ID))"; expected "UNSIGNED, ARRAY, INVISIBLE, VISIBLE, NOT NULL, DEFAULT, GENERATED, ON UPDATE, NOT NULL, DEFAULT ON NULL, SEQUENCE, SELECTIVITY, COMMENT, CONSTRAINT, COMMENT, PRIMARY KEY, UNIQUE, NOT NULL, CHECK, REFERENCES, ,, )"; SQL statement:
CREATE TABLE hzb_notice_template (ID BIGINT IDENTITY NOT NULL, CONTENT LONGVARCHAR, CREATOR VARCHAR, GMTCREATE TIMESTAMP, GMTUPDATE TIMESTAMP, MODIFIER VARCHAR, NAME VARCHAR, PRESET boolean default false, TYPE SMALLINT, PRIMARY KEY (ID)) [42001-224]
Error Code: 42001
Call: CREATE TABLE hzb_notice_template (ID BIGINT IDENTITY NOT NULL, CONTENT LONGVARCHAR, CREATOR VARCHAR, GMTCREATE TIMESTAMP, GMTUPDATE TIMESTAMP, MODIFIER VARCHAR, NAME VARCHAR, PRESET boolean default false, TYPE SMALLINT, PRIMARY KEY (ID))
Query: DataModifyQuery(sql="CREATE TABLE hzb_notice_template (ID BIGINT IDENTITY NOT NULL, CONTENT LONGVARCHAR, CREATOR VARCHAR, GMTCREATE TIMESTAMP, GMTUPDATE TIMESTAMP, MODIFIER VARCHAR, NAME VARCHAR, PRESET boolean default false, TYPE SMALLINT, PRIMARY KEY (ID))")

Signed-off-by: tomsun28 <tomsun28@outlook.com>
@github-actions github-actions bot added the infra label Apr 22, 2024
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28
Copy link
Contributor Author

tomsun28 commented Apr 23, 2024

upgrade this attention. If you use an empty database, there is no need to upgrade.

  1. Export Import Method (suggest)

export the all monitoring, export all alarm rules, and deploy start a new one system, import them.

  1. Database Method

edit the h2 database columns, if use mysql, change the mysql columns

ALTER TABLE HZB_PARAM  ALTER COLUMN  "value" RENAME TO  param_value;

ALTER TABLE HZB_TAG ALTER COLUMN "value" RENAME TO  tag_value;

ALTER TABLE HZB_STATUS_PAGE_HISTORY ALTER COLUMN "unknown" RENAME TO  unknowing;

start the system.

edit the save all notice rule in web, disable and enable them.

@tomsun28 tomsun28 marked this pull request as ready for review April 23, 2024 05:22
Signed-off-by: tomsun28 <tomsun28@outlook.com>
Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28 tomsun28 requested a review from zqr10159 April 23, 2024 06:05
@zqr10159
Copy link
Member

zqr10159 commented Apr 23, 2024

upgrade this attention. If you use an empty database, there is no need to upgrade.

  1. Export Import Method (suggest)

export the all monitoring, export all alarm rules, and deploy start a new one system, import them.

  1. Database Method

edit the h2 database columns, if use mysql, change the mysql columns

ALTER TABLE HZB_PARAM  ALTER COLUMN  "value" RENAME TO  param_value;

ALTER TABLE HZB_TAG ALTER COLUMN "value" RENAME TO  tag_value;

ALTER TABLE HZB_STATUS_PAGE_HISTORY ALTER COLUMN "unknown" RENAME TO  unknowing;

start the system.

edit the save all notice rule in web, disable and enable them.

The mysql 5.7 version is not able to execute these sql's and I think upgrading these is best for the user not to operate, can we find a better way?

@tomsun28
Copy link
Contributor Author

The mysql 5.7 version is not able to execute these sql's and I think upgrading these is best for the user not to operate, can we find a better way?

hi these sql are for h2 database, mysql version we can use navicat console or others to edit table column name here.

ALTER TABLE HZB_PARAM CHANGE COLUMN `value` param_value VARCHAR(255);

ALTER TABLE HZB_TAG CHANGE COLUMN `value` tag_value VARCHAR(255);

ALTER TABLE HZB_STATUS_PAGE_HISTORY CHANGE COLUMN `unknown` unknowing VARCHAR(255);

For the suggest upgrading, is the Export Import Method. Deploy an new empty system and them import the monitors.

@zqr10159
Copy link
Member

Is it possible to determine the current version at program startup and execute sql automatically?

@tomsun28
Copy link
Contributor Author

flyway or liquibase can do this, maybe we can consider use flyway to execute version update sql automatically.
Use jpa auto create tables and use flyway auto upgrde sql change.
I can try it in anothor new pr.

@zqr10159
Copy link
Member

Flyway

sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants