Posts

Showing posts with the label jpa

What is the configurations for enabling `ehcache replication`?

What is the configurations for enabling `ehcache replication`? I have a project that used JPA and Hibernate in DataAccessLayer with OraclDB and WebLogic application server. Also, I provided second-level-cache through ehcache as following configs: second-level-cache ehcache ehcache.xml <ehcache> <diskStore path="java.io.tmpdir"/> <defaultCache> maxEntriesLocalHeap="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" maxEntriesLocalDisk="10000000" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU"/> <persistence strategy="localTempSwap" </defaultCache> </ehcache> persistence.xml <persistence-unit name="datasource1" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>my_datasource...

How to serialize a json containing LAZY associations

How to serialize a json containing LAZY associations I am having an Person entity which has @ManyToOne association with Contact entity with fetch type LAZY. I am using spring-boot to expose REST API. One of my POST call contains nested JSON to save the parent entity Person along with association Contact Person @ManyToOne Contact Person Contact Since Contact fetch type is LAZY, I am encountering into following exception Contact ERROR 17415 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and ...