Database being used is Oracle 11g The sequence is present in the specified schema in the database and the same query returns proper value when executed via sql developer. The Auto generation configuration is as follow: Spring JPA configuration is as follow: Answer Kindly check if the user which you are using has the read/write privilege
Tag: spring-data-jpa
Spring data JPA: how to enable cascading delete without a reference to the child in the parent?
Maybe this is an overly simple question, but I am getting an exception when I try to delete a user entity. The user entity: And I have an entity class which references a user with a foreign key. What I want to happen is that when the user is deleted, any PasswordResetToken objects that reference the user are also deleted.
native query join in spring data
I have the class: I want to know if it’s possible to use a native query join in spring data JPA and if the result of query was correctly mapped into entities like the above example. Can someone show me a complete example to user this. I must to use a native query in my case and I am not
Creating Pagination in Spring Data JPA
I am trying to implement pagination feature in Spring Data JPA. I am referring this Blog My Controller contains following code : My DAO is following : I am able to show first 20 records, how do I show next 20??? Is there any other pagination example that I can refer?? Answer I’ve seen similar problem last week, but can’t
How to set initial value for @Id @GeneratedValue in Spring JPA for MySQL?
I can not figure out how to set the initial value for the @GenerateValue @Id. I have tried using GenerationType.SEQUENCE but that is not allowed in MySQL. How can I set the initial value to be used for the @GenerateValue? Using both AUTO and TABLE I can still not get the initial value to start at anything but 1 Thank
How to find cortege with OneToMany relation in Spring Data JPA
I use Spring Data JPA and have two entities: and And repository: I need to find available vehicles, which not booked by time. How can I do this? Answer I would go for something like: BTW I think that you might wanna try to change FetchType from EAGER to LAZY for bookingTime and then use join fetch in select query.
`Type cannot be null` exception when trying to run out Stored Procedure using Spring Data JPA
I am trying to invoke a Stored Procedure whose signature looks like the following: I am using Spring-Data JPA and have tried a number of different variants, but all of them follow more or less the following pattern. My entity model is decorated as follows: Then I have my repository which looks like the following: I have followed the instructions
Unexpected empty result using spring query method
I am building an application with a REST API using spring boot and JPA connected to a MySQL database. To search for names in the User class I have implemented a query method: List< User > findByFirstnameLike( String name ); This method only returns a result on an exact match, which is not what I wanted. Have I misunderstood something
Calling stored procedure using OUT parameter with Spring Spring JPA 2.*
I am calling a stored procedure using IN parameter – it’s working fine. Need help how to do it for OUT parameters. Answer Refer below link for how to call a stored procedure. https://dzone.com/articles/calling-stored-procedures-from-spring-data-jpa
spring boot starter security post methods not working
I have added spring ‘spring-boot-starter-security’ to existing spring boot project ; after that the post methods in spring rest controller not working properly it shows a error something like this : my controller method is this: pom file: if i remove all these security related stuff the code is working great . Is there any thing wrong in my configuration