title: How is the entity being saved to the database without a transaction?
body: <p>I am able to save an entity without <code>@Transactional</code> in my Spring Boot application. I only noticed this because I wasn't able to update an entity until I added <code>@Transactional</code> to the <code>save</code> method within <code>EmployeeService.java</code>.</p>
  
  <p>I don't have <code>@Transactional</code> annotated at the class level. The only other place it is found is on methods in my Service layer that do not pertain to the <code>save</code> method. My <code>EmployeeDAO</code> does not extend <code>JPARepository</code>. It is annotated with <code>@Repository</code>. I have <code>spring-boot-starter-data-jpa</code> as a dependency. I am not manually beginning or committing a transaction either. </p>
  
  <p><code>EmployeeRestController.java</code></p>
  
  <pre><code>@PostMapping("/employees")
  public void addEmployee(@RequestBody Employee employee) {
      employee.setId(0);
  
      employeeService.save(employee);
  }
  </code></pre>
  
  <p><code>EmployeeService.java</code></p>
  
  <pre><code>public void save(Employee employee) {
      emplDAO.save(employee);
  }
  </code></pre>
  
  <p><code>EmployeeDAO.java</code></p>
  
  <pre><code>@Override
  public void save(Employee employee) {
      Session currentSession = em.unwrap(Session.class);
  
      currentSession.saveOrUpdate(employee);
  }
  </code></pre>