kevinw66 commented on code in PR #55: URL: https://github.com/apache/bigtop-manager/pull/55#discussion_r1732473947
########## bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/converter/JsonToMapConverter.java: ########## @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.bigtop.manager.dao.converter; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import java.util.Map; + +@Converter +public class JsonToMapConverter implements AttributeConverter<Map<String, String>, String> { + @Override + public String convertToDatabaseColumn(Map<String, String> attribute) { + // Convert Map to JSON String + return new Gson().toJson(attribute); Review Comment: Please use JsonUtils.writeAsString() instead ########## bigtop-manager-dao/pom.xml: ########## @@ -73,6 +73,16 @@ <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> </dependency> + <dependency> + <groupId>org.eclipse.persistence</groupId> + <artifactId>org.eclipse.persistence.jpa</artifactId> + </dependency> Review Comment: Why add eclipselink dependency here? ########## bigtop-manager-dao/pom.xml: ########## @@ -73,6 +73,16 @@ <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> </dependency> + <dependency> + <groupId>org.eclipse.persistence</groupId> + <artifactId>org.eclipse.persistence.jpa</artifactId> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.10.1</version> + <scope>compile</scope> + </dependency> Review Comment: We can remove this ########## bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/converter/JsonToMapConverter.java: ########## @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.bigtop.manager.dao.converter; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import java.util.Map; + +@Converter +public class JsonToMapConverter implements AttributeConverter<Map<String, String>, String> { + @Override + public String convertToDatabaseColumn(Map<String, String> attribute) { + // Convert Map to JSON String + return new Gson().toJson(attribute); + } + + @Override + public Map<String, String> convertToEntityAttribute(String dbData) { + // Convert JSON String to Map + return new Gson().fromJson(dbData, new TypeToken<Map<String, String>>() {}.getType()); Review Comment: Same here ########## bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql: ########## @@ -321,6 +321,66 @@ CREATE TABLE `stage` KEY `idx_job_id` (`job_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `platform` Review Comment: Please add `llm_` prefix for these tables -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
