Skip to content
Advertisement

Tag: spring-data-jpa

JPA Entity for View containig joins and aliases

I have the following query using which I want to create an entity class for the columns which I am retrieving from the query. How to create an entity class from these columns and what variables are needed to take it in entity class to refer to these columns? Answer View is a virtual table based on the result-set of

Error creating entityManagerFactory.Unable building Hibernate SessionF.SchemaManagementException:Export identifier[new_user]encountered more than once

My controller class – My JpaRepository extended interface – My Pojo class – And , the errors which it is giving is – org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Export identifier [new_user] encountered

Delete from a JPARepository with an EmbeddedId by a field in the primary key

Currently I have a Spring Boot application using JpaRepository<Employee, EmployeePk> where let’s say EmployeePk is firstname, lastname. Is there a way to delete by Primary Key field without having to specify a custom @Query? It’s ok to delete multiple rows if multiple people were named “John”. Example: such as Employee class and Embedded PK Answer Thanks for adding the Employee

Spring Data cosmos @Transactions support

With Azure Cosmos DB transactional batch support available for Cosmos Java SDK 4.7.0, Does Spring Data Cosmos allows transactional operations? I went through Spring Data Cosmos Github Documentation, but didn’t find a reference. Need help if there is a way to implement transaction batch operations via spring cosmos data. If there is no way currently, then what would be the

Spring Data Jpa Repository not saving entities to database

Im having some difficulties using jpa. Im not getting any exceptions, but I cant save anything to the database. I went from Hibernate to Jpa and everything worked perfectly there. Below are my Files application.properties: Model: Repository: Service: I’m getting a 200 Response when submitting the form, but can’t find the data in the database Answer You are using a

JPA Hibernate many to many IllegalStateException

I’m attempting to create a many to many relationship. I have a table ‘library_branch’ and i want to join ‘BookCopies’ which contains ‘bookId’, ‘branchId’ and ‘noOfCopies’. I have an error ErrorMvcAutoConfiguration$StaticView. I’m not sure where I’m causing this infinite recursion, any help will be greatly appreciated. 2021-11-26 14:54:43.544 ERROR 22348 — [nio-8080-exec-1] s.e.ErrorMvcAutoConfiguration$StaticView : Cannot render error page for request

Spring boot sort.by() No property found for type

I have MemberSchedule Entity and I want to get all items sorted by “start_time”, but error occurs with message No property start found for type Member Schedule!. I think the reason is Sort.by() didn’t recognize _ string. Because using other property like “content” works well. How can I solve this problem? error log Answer Adding my comment as an answer:

MongoDB Extract document

I have this Json: I would like to filter exclusive for paymentType.type equals “PILOT” and limits equals type equals “COMBAT_HOURS”. This is the result I would like to receive. How to extract the document to reach this result? Answer Query map paymentTypes if paymentType= PILOT, filter the limits to keep only the combat hours else null (we don’t want that

Advertisement