spring-data-rest

After upgrade from Spring Boot 1.5 to 2.1 we get Target bean of type com.sun.proxy.$Proxy is not of type of the persistent entity

牧云@^-^@ 提交于 2021-01-29 06:54:21
问题 We upgraded from Spring Boot 1.5.13.RELEASE to 2.1.3.RELEASE and now a POST to Spring Data Rest with a projection is failing with this error: java.lang.IllegalArgumentException: Target bean of type com.sun.proxy.$Proxy313 is not of type of the persistent entity (com.*.*.*.BankAccount)!: com.sun.proxy.$Proxy313 This looks very similar to the old ticket: https://jira.spring.io/si/jira.issueviews:issue-html/DATAREST-1213/DATAREST-1213.html The JUnit test passes: @Test public void

Events “beforeLinkSave” and “afterLinkSave”

早过忘川 提交于 2021-01-27 13:32:12
问题 I'm trying to understand how works the validation events in Sprind data REST. I understand that the event "beforeSave" runs just before I save a new information in the data source. I understand that the event "afterSave" is called at the end of storeing a new data. However, I don't understand when the events "beforeLinkSave" and "afterLinkSave" are run. Does someone know the answer? 回答1: I have learned. The event "beforeLinkSave" is run before a new link is saved in an one to many or many to

Spring Data REST HATEOS : not lazy loading

≯℡__Kan透↙ 提交于 2021-01-22 05:21:12
问题 Problem I have two entities defined: School and District . A district can have many schools and a school can belong to one district. When executing a GET request against this endpoint http://localhost:8080/districts I would like to get a list of all the districts WITHOUT fetching each district's set of associated schools. But it seems like no matter what I do, hibernate is making DB calls to fetch data for each school individually. Entities School @Getter @Setter @NoArgsConstructor @Entity

Spring Data Rest: “Date is null” query throws an postgres exception

笑着哭i 提交于 2021-01-21 06:37:08
问题 I use Spring Boot and Data Rest to create a simple microservice in Java8 and get a postgres exception. My entity: @Entity public class ArchivedInvoice implements Serializable { ... @Column private String invoiceNumber; @Column private java.sql.Date invoiceDate; ... } My repository interface: @RepositoryRestResource(collectionResourceRel = "archivedinvoices", path = "archivedinvoices") public interface ArchivedInvoiceRepository extends PagingAndSortingRepository < ArchivedInvoice, Long > { ...

Custom controller with Spring Data REST hide default endpoints

二次信任 提交于 2021-01-01 07:21:13
问题 I'm using Spring Boot, Spring Data REST, Spring HATEOAS, Hibernate, JPA. I'm using extensively Spring Data REST in my application and I expose all Repositories of my entities. Unfortunately there are some particular cases that are not so easy to manage. One of that is this: I've a custom controller: @Api(tags = "CreditTransfer Entity") @RepositoryRestController @RequestMapping(path = "/api/v1") @PreAuthorize("isAuthenticated()") public class CreditTransferController { @RequestMapping(method =

Custom controller with Spring Data REST hide default endpoints

北战南征 提交于 2021-01-01 07:19:17
问题 I'm using Spring Boot, Spring Data REST, Spring HATEOAS, Hibernate, JPA. I'm using extensively Spring Data REST in my application and I expose all Repositories of my entities. Unfortunately there are some particular cases that are not so easy to manage. One of that is this: I've a custom controller: @Api(tags = "CreditTransfer Entity") @RepositoryRestController @RequestMapping(path = "/api/v1") @PreAuthorize("isAuthenticated()") public class CreditTransferController { @RequestMapping(method =