Intellij IDEA is not able to detect jdk what to do?

I have recently moved from windows to ubuntu-22.04 and it is a bit confusing. I have installed intellij IDEA, after installing java and jdk, but still intellij is not able to detect the jdk version installed in my pc.intellij not detecting jdk The path of installed java is also set but still it is not… Read More Intellij IDEA is not able to detect jdk what to do?

Transaction propagation in spring @required

@GetMapping("trans") @Transactional() public String primaryTrans() { User u1 = new User(0,"test","test@email.com"); us.save(u1); User u2 = new User(0,"test1","test1@email.com"); us.save(u2); secondaryTrans(); return "index"; } @Transactional(propagation = Propagation.REQUIRES_NEW) private void secondaryTrans() { // TODO Auto-generated method stub User u2 = new User(0,"test2","test3@email.com".repeat(300)); us.save(u2); } Here i am manually raising DATA TOO LONG exception from secondary transaction, But it… Read More Transaction propagation in spring @required

Java Process Class: Why command "java -version" does not produce outputstream while command "ls -l" does?

Below program: public class ProcessExample { public static void main(String[] args) throws IOException { Process process1 = new ProcessBuilder("/bin/ls", "-l").directory(Path.of("/home/yapkm01").toFile()).start(); System.out.println("ls command:"); try (var in = new Scanner(process1.getInputStream())) { while (in.hasNextLine()) { System.out.println(in.nextLine()); } } Process process2 = new ProcessBuilder("/bin/java", "-version").start(); System.out.println("java command:"); try (var in = new Scanner(process2.getInputStream())) { while (in.hasNextLine()) { System.out.println(in.nextLine()); }… Read More Java Process Class: Why command "java -version" does not produce outputstream while command "ls -l" does?

Java stream: using Collectors to grouBy Map

I would like to transform: Map<Integer, List<Integer>> result = dre.getItems().stream().collect( Collectors.groupingBy(DashboardEntity::getElementNumber, Collectors.mapping(DashboardEntity::getTotalElement , Collectors.toList()) ) ); into (naive): Map<Integer, List<String>> result = dre.getItems().stream().collect( Collectors.groupingBy(DashboardEntity::getElementNumber, Collectors.mapping(DashboardEntity::getTotalElement + "_" DashboardEntity::getDate, Collectors.toList()) ) ); But the latter would raise a compile time error: Method reference expression is not expected here What would be the way to get result… Read More Java stream: using Collectors to grouBy Map

Upgrading Maven plugins to Java 11

I am upgrading my Maven-built, Java 8 app to Java 11. In my POM I specify: <properties> <java.version>1.11</java.version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> </properties> When I go to build my app using my normal Maven build invocation: mvn verify -Plocal -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" I get: [INFO] Scanning for projects… [INFO] [INFO] ———————–< example.com:myapp-svc >———————— [INFO] Building myapp-svc 1 [INFO]… Read More Upgrading Maven plugins to Java 11