title: JPA invalid stream header: 32303138
body: <p>I'm new with JPA / Hibernate with Spring Boot and I've been facing the same error for over 6hours now, this is driving me crazy.</p>
  
  <p>Basically, it all start at my Controller here</p>
  
  <pre><code>@RestController
  @RequestMapping("patientApi")
  public class RestPatientController {
  
      public static final Logger LOGGER = LoggerFactory.getLogger(RestPatientController.class);
  
      @Autowired
      private PatientService patientService;
  
      [...]
  
      @RequestMapping(value = "/patient/prises_en_charge/{id}", method = RequestMethod.GET)
      public ResponseEntity&lt;List&lt;PriseEnCharge&gt;&gt; listAllPrisesEnChargeByPatient(@PathVariable("id") long id) {
  
          Patient currentPatient = patientService.findById(id);
          LOGGER.info("Récupération de toutes les prises en charges d'un patient avec id {}", currentPatient);
          List&lt;PriseEnCharge&gt; prisesEnCharge = patientService.findAllPrisesEnChargeByPatient(currentPatient);
          LOGGER.info("Liste de prises en charge {} ({} elements)", prisesEnCharge, prisesEnCharge.size());
          if (prisesEnCharge.isEmpty()) {
              LOGGER.debug("La liste des prises en charge est vide");
              return new ResponseEntity(HttpStatus.NO_CONTENT);
              // You many decide to return HttpStatus.NOT_FOUND
  
          }
          return new ResponseEntity&lt;List&lt;PriseEnCharge&gt;&gt;(prisesEnCharge, HttpStatus.OK);
      }
  
  }
  </code></pre>
  
  <p>where I catch the ID of the element I want more data for. I then call the DAO within my service</p>
  
  <pre><code>@Service("patientService")
  @Transactional
  public class PatientServiceImpl implements PatientService {
  
      @Autowired
      private PriseEnChargeDao priseEnChargeDao;
  
      [...]
  
      @Override
      public List&lt;PriseEnCharge&gt; findAllPrisesEnChargeByPatient(Patient patient) {
          return priseEnChargeDao.findPriseEnChargeByPatient(patient);
      }
  
  }
  </code></pre>
  
  <p>DAO being</p>
  
  <pre><code>@Repository
  public interface PriseEnChargeDao extends JpaRepository&lt;PriseEnCharge, Long&gt; {
  
      @Query("from PriseEnCharge where id_patient = :patient")
      public List&lt;PriseEnCharge&gt; findPriseEnChargeByPatient(@Param("patient") Patient patient);
  
  }
  </code></pre>
  
  <p>No matter what I tried It keeps throwing exception "java.io.StreamCorruptedException: invalid stream header: 32303138". I honnestly don't know anymore, I'm kinda despaired on that case.</p>