본문 바로가기

Beakjoon&프로그래머스/Java139

[JPA] 영속성 컨텍스트 영속성 컨텍스트 영속성 컨텐스트란 엔티티를 영구 저장하는 환경이라는 뜻으로 애플리케이션과 데이터베이스 사이에서 객체를 보관하는 가상의 데이터베이스 같은 역할을 합니다. 엔티티 매니저를 통해 엔티티를 저장하거나 조회하면 엔티티 매니저는 영속성 컨텍스트에 엔티티를 보관하고 관리하게 됩니다. // 엔티티 매니저를 사용해 사용자 엔티티를 영속성 컨텍스트에 저장한다는 의미입니다. em.persist(user); 🏷️ 특징 ✅ 영속성 컨텍스트 생성 시점 엔티티 매니저를 생성할 때 하나 만들어집니다. ✅ 영속성 컨텍스트관리 엔티티 매니저를 통해서 영속성 컨텍스트에 접근하고 관리할 수 있습니다. ✅ 영속성 컨텍스트의 식별자 값 영속성 컨텍스트는 엔티티를 식별자 값으로 구분하기 때문에 영속 상태는 식별자 값이 반드시 있.. 2024. 3. 2.
[백준/Java] 24296번 ЛИНИЯ -Code import java.util.Scanner; public class _24296 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int res = 2; boolean flag = false; while (true) { int temp = res; while (true) { if (temp == n) { flag = true; break; } if (temp > n) { break; } temp += temp - 1; } if (flag) { break; } res++; } System.out.println(res); } } 2024. 2. 23.
[백준/Java] 28417번 스케이트보드 -Code import java.util.Arrays; import java.util.Scanner; public class _28417 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int res = 0; for (int i = 0; i < n; i++) { int[] two_track = new int[2]; int[] five_track = new int[5]; for (int j = 0; j < 2; j++) { two_track[j] = sc.nextInt(); } for (int j = 0; j < 5; j++) { five_track[j] = sc.nextI.. 2023. 12. 30.
[백준/Java] 29766번 DKSH 찾기 - Code package com.in28minutes.learnspringframework; import java.util.Scanner; public class _29766 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); int res = 0; for (int i = 0; i < line.length() - 3; i++) { String s = line.substring(i, i + 4); if (s.equals("DKSH")) { res++; } } System.out.println(res); } } 2023. 10. 6.
[백준/Java] 11718번 그대로 출력하기 -Code import java.util.Scanner; public class _11718 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { System.out.println(sc.nextLine()); } } } 2022. 10. 27.
[백준/Java] 25314번 코딩은 체육과목 입니다 -Code import java.util.Scanner; public class _25314 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int t = (int) Math.ceil(n / 4); for (int i = 0; i < t; i++) { System.out.print("long "); } System.out.println("int"); } } 2022. 10. 27.