org hibernate type SerializationException could not deserialize

org hibernate type SerializationException could not deserialize

This is very common exception if you are working with hibernate. This happens while you make call to the database where connection to the database is successful but while returning the data java model class for hibernate not able to deserialize and map the data. It occurs due to data mismatch and most of time I saw it happens for date attribute. Below is full details of exception:

Exception in thread “main” org.hibernate.type.SerializationException: could not deserialize

Caused by: invalid stream header: 0000A540

  • Solution: You will have to properly deserialize the data in your model class. Below is two class which you can use one for LocalDate and another one for LocalDateTime:


Very important:

  • Suppose you hibernate query is returning LocalDate and if attributes defined in model then you can use as below:

  • If you are using LocalDateTime then please include in your model class as below:

This should resolve above issue. For more information please visit here

Leave a Reply

Your email address will not be published. Required fields are marked *