Skip to content
Advertisement

Tag: hibernate

Cast exception when trying to get the resultset in hibernate “Cannot cast ‘java.lang.Object[]’ to”

In my application im using Hibernate 3.3 for the data connection. When im trying to get the resultset by a native query, it throws Cannot cast ‘java.lang.Object[]’ to org.model.Term exception. Model class : Dao method : persistence config : table structure : When query.getSingleResult(); is evaluated the results are there. What might be causing this issue? Answer EntityManager.createNativeQuery(String sqlString) is

How to use Redis as L2 cache on Hibernate?

I have a spring boot application and need to setup Redis as l2 cache on hibernate. My prop file looks like: I created a custom region factory because I don’t want to use json or yaml files. (right now, the parameters are hardcoded). CustomRegionFactory class looks like: Using redis-cli I found out that all my entities annotated with @Cacheable are

Why are related entities being escaped when converted to JSON?

I have a Spring MVC controller which fetches some entities via a query. These entities have a related entity that is eagerly fetched. However, when I use JSONObject.toString() it escapes the related model data: The value in the language property is an escaped JSON object from the related entity. Why is it being escaped like that? How do I prevent

ClassNotFoundException for HibernatePersistenceProvider

I have a JSF project which builds perfectly with java 7, but when I try to deploy the WAR in Jboss Application Server, I’m getting the bellow error. The persistance.xml looks like bellow The bellow dependencies are included in the pom The JBoss version is 7.1.1 Final What am I doing wrong here? Answer The issue here was the conflict

Programmatically restart HikariPool in Spring Boot application?

I have a Spring Boot application which uses Hibernate, and HikariDataSource / HikariPool to talk to the database. A special feature in the app triggers database restart. Currently this breaks the connections in HikariPool: Old version of the app does call programmatically org.hibernate.SessionFactory.close(); which causes restart of HikariDataSource / HikariCP: I would like to do the same, but how can

JPA many to many relationship causing infinite recursion

Edit: I solved the problem using @JsonIgnoreProperties in both classes I have two entities in my api. Pokemon which has a list of “types” that pokemon have and Type which has a list of “pokemon” that have that specific type. I’m trying to implement a getAll method in my controllers but i’m having an infinite recursion problem. I’ve tried to

Advertisement