java.lang.StackOverflowError: null at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields

I’m trying to create an app that allows to track the couriers, using Sptring boot. But here I got struggled with some problem. When I try to call get_couriers function, it throws me this exception: java.lang.StackOverflowError: null at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:145) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:107) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728) ~[jackson-databind-2.13.3.jar:2.13.3]… Read More java.lang.StackOverflowError: null at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields

Spring boot oracle doesn't excute data.sql on startup

I have setup oracle as a database, I’m connected to it and can do CRUD operations using spring boot, however, the data.sql file in the resources folder doesn’t seem to get excuted spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.hibernate.ddl-auto=none spring.jpa.generate-ddl=false spring.datasource.initialization-mode=always this is my jpa properties, and this is my jpa dependency <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jdbc</artifactId>… Read More Spring boot oracle doesn't excute data.sql on startup

Use Spring Data JPA API: How to get list of Account by tennat_id (belong to a composite primary key)?

I am using Spring Boot 2.7.2 , Java/JDK 18 , PostgreSQL 14. DDL SQL script DROP TABLE IF EXISTS tenant; CREATE TABLE tenant ( id smallint primary key, company_tax_code character varying(14), period character varying(16), — 2021070420220705 created timestamp with time zone ); CREATE OR REPLACE FUNCTION set_id_tenant() RETURNS trigger AS $$ DECLARE BEGIN new.id =… Read More Use Spring Data JPA API: How to get list of Account by tennat_id (belong to a composite primary key)?

Deprecated: Hibernate setHint

According to the Hibernate 5.2 doc, Hibernate Query setHint is deprecated now. Is there an alternative to that now? >Solution : If you scroll to the top of the document, you can see that using org.hibernate.Query is deprecated since 5.2. You can use org.hibernate.query.Query instead. Here‘s the new documentation.

"org.hibernate.PersistentObjectException: detached entity passed to persist" error that I can't work my head around

I’ve recently started working with JPA and Hibernate for a school project, and it basically stores continents, countries and cities in a database. When trying to use the persist method on an entity, I get the error mentioned in the title. Whichever threads I’ve visited tackle a lot more complex problems, and don’t really help… Read More "org.hibernate.PersistentObjectException: detached entity passed to persist" error that I can't work my head around

Class X cannot be cast to class Boolean (X is in unnamed module of loader 'app'; Boolean is in module java.base of loader 'bootstrap

I noticed that when others are getting this problem, it is because they are trying to cast objects. I am not trying to cast. Furthermore, I am trying to ask if an object exists in a data table using Spring Boot repository. The following issue is occurring: What is the issue exactly? The model: @Entity… Read More Class X cannot be cast to class Boolean (X is in unnamed module of loader 'app'; Boolean is in module java.base of loader 'bootstrap

else if statement java gui wont execute

I have been trying to make a java GUI distance converter. My else if statement won’t execute, only the first if statement execute. Does anyone know why i wont executed? Below is my coding and the output. import javax.swing.*; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.*; public class DistanceCalculator implements ActionListener { private JFrame frame; private… Read More else if statement java gui wont execute

Update statement is no query?

How do I define the update statement in the orm.xml. I have it as a named-query and everything works, but my teacher said that an update statement isn’t a query. I have tried a native query, but that wasn’t working. ORM-Type: <?xml version="1.0" encoding="UTF-8"?> <entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"> Update Statement: <named-query name="updateTshirts"> <query>… Read More Update statement is no query?

Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator

I’m trying to build a repository with product class as entity. There seems to be something wrong with the Id generator. Here’s my product entity Product.java package com.example.repository.model; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy =… Read More Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator