Entity Lifecycle
1. package com.appsdeveloperblog.ws.demo_transactional; import com.appsdeveloperblog.ws.demo_transactional.entity.Account; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import lombok. RequiredArgsConstructor ; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure. SpringBootApplication ; @SpringBootApplication @RequiredArgsConstructor public class DemoTransactionalApplication implements CommandLineRunner { private final EntityManagerFactory emf ; public static void main (String[] args) { SpringApplication. run (DemoTransactionalApplication. class , args); } @Override public void run (String... args) throws Exception { EntityManager em = emf .createEntityManager(); em.getTransaction().begin(); // Transient mode: because it does not exist in DB Account account = new Account(); // Ma