Spring – Same entity detached on the @EventListener but attached in the @Service class

I have following classes in my Spring application: TaskService and DevStartup. When application starts DevStartup is run, but the Tag(“Home”) is seen as detached entity on tasksRepository.save(task) which throws detached entity exception during startup. @Component @AllArgsConstructor @Slf4j @Profile(“dev”) public class DevStartup { private final TagsService tagsService; private final TagsRepository tagsRepository; private final TasksRepository tasksRepository; private…

Details

trouble setting state in reactjs

I have a very simple code to set a state variable but have trouble. https://codesandbox.io/s/highcharts-react-demo-rtlie I see the this.state.chart_options being displayed on the console but its null. Code:_ import React from “react”; import { render } from “react-dom”; // Import Highcharts import Highcharts from “highcharts/highstock”; import drilldow from “highcharts/modules/drilldown”; //import HighchartsReact from “./HighchartsReact.js”; import PieChart…

Details

How can i send the responce.body out of request module function?

How can i do that?I started by creating a return statement into the request function(i have linked a picture) and then console.log it outside of the function but that didnt worked out. JavaScript var options = { ‘method’: ‘POST’, ‘url’: ‘http://localhost:8080/ES_Part1/api/user/getUser’, ‘headers’: { ‘Content-Type’: ‘application/x-www-form-urlencoded’ }, form: { ‘username’: username, ‘password’: password } }; requestToApi(options,…

Details

Square roots by Newton’s method

The following Scheme program implements Newton’s method for computing the square root of a number: (import (scheme small)) (define (sqrt x) (define (sqrt-iter guess) (if (good-enough? guess) guess (sqrt-iter (improve guess)))) (define (good-enough? guess) (define tolerance 0.001) (< (abs (- (square guess) x)) tolerance)) (define (improve guess) (if (= guess 0) guess (average guess (/…

Details