How to call stored procedure using Spring data jpa #JavaTechie #SpringBoot #StoredProcesure GitHub: github.com/Jav... Facebook : / 919464521471923 Blog : javagyanmantra... Like & subscribe
Пікірлер: 94
@poojashetty4794 жыл бұрын
amazing...very nicely explained...this is what i was looking for thank you
@kaushaladlak42227 жыл бұрын
Thank you sir it is very helpful for everyone...superb
@johnbritto78504 жыл бұрын
thank u so much...u saved my life:):)
@luisantoniojachozambrano76055 жыл бұрын
For some reason i tried this and had an error with the parameters i had a error: parameter has been not registered. So i tried solething like this in the dao classand it worked ! for anyone who needs it !. thanks 4 the video. StoredProcedureQuery query = em.createStoredProcedureQuery("calculate"); query.registerStoredProcedureParameter("x", Double.class, ParameterMode.IN);
@Javatechie5 жыл бұрын
Cool Luis
@rajuranjan9107 жыл бұрын
Thank you very much for uploading and your time
@bigstars18276 жыл бұрын
Good explanation.. Liked it.
@sagarchpatro5 жыл бұрын
Bhai.. Tame poora jhakkaas explanation daucha
@mukeshmishra6967 Жыл бұрын
Basant Bhai, you told we don't need to modify the code in case of in future any other table fields are required to access, only we can change in the stored procedure itself. But, Like for this example, you have added procedure parameter in the code for "category", similarly in future, if we require 4 other fields along with category, then apart from changing in stored procedure, we have to add other fields as Procedure Parameters also in our code, right?? Then how is this approach becoming feasible? Please help.
@mayanksrkumar164 жыл бұрын
Thans a lot. This worked for me.
@SamPaulIsaac11 ай бұрын
Thanks, it helps!
@VikasSharma-hm6xt2 жыл бұрын
well Explained
@vikassharma-e4x4i9 ай бұрын
sir plesae make a video on how to call a procedure with mutiple joins (it is returing a list of result set that is a combination multiple tables )
@tranxuano1092 Жыл бұрын
thank sir, can u add English sub for your video? it's very helpful
@Javatechie Жыл бұрын
This is an old video so I wasn't enabled but i will do that .
@abdallaabuu66084 жыл бұрын
In the dao class, function to insert,update and delete and in controller in this example u tought us only select using list function Thanks
@aryashrestha66015 жыл бұрын
simple and easy thanks mate.
@soni21rajeev3 жыл бұрын
Thanks ..looking for it.
@sunilbehera21767 жыл бұрын
nice bro.
@rohitkrishnamurthy63224 жыл бұрын
Hi, Thanks for this detailed video. I have created the standalone service as thought in your video as per my requirements, it worked perfectly fine. When I integrated with other project, the same service, this is throwing error as no @NamedStoredProcedureQuery was found with that name= Please note there is no in and out parameter in my case. Thank you in advance!
@Selscript7 ай бұрын
Hi, if I need key value pair then how can I get these values?
@thecolonyengineer3 жыл бұрын
thanks a lot!
@Зебратв-п7э2 жыл бұрын
can i do the same with oracle procedure pl/sql
@Javatechie2 жыл бұрын
Yes you can do that
@michaeledwards4606 жыл бұрын
This is showing a simple example where I am linking one entity to a stored procedure that selects data from a table containing records of data for that entity. In reality we are going to use complex stored procedures joining multiple tables. how do I call a stored procedure that is joining multiple tables and is performing complex operations? Do I just link all the entities that are used in that stored procedure or what? Just need some clarification on that. Every where else I look I am seeing simple examples like what you just showed.
@emmaaloysius42414 жыл бұрын
I am also looking for this solution. How to invoke a Stored Procedure which cannot be associated with a single Entity class
@Javatechie4 жыл бұрын
Hi we can map multiple entity join query in stored procedure Are you getting any issue on that
@emmaaloysius42414 жыл бұрын
@@Javatechie Thanks for the response. So, if a procedure is using multiple tables, to which Entity do we link this procedure.
@emmaaloysius42414 жыл бұрын
@@Javatechie Sorry I didn't follow what is meant by 'map multiple Entity join query in Stored procedure'
@ayusitika3 жыл бұрын
@@emmaaloysius4241 did you find any solution for that....... as far as i can understand it means we can define the output schema in our entity whihch will be returned by the stored procedure....instead of definining multiple entities in our spring application ...that part is to be done by store procedure...we just need to create one or more entity depending on what will be returned by store procedure..... let me know if you find any solution or am i wrong in this approach.
@dileepalla67697 жыл бұрын
super
@abdallaabuu66084 жыл бұрын
Thank u for nice tutorial but how to do insert,update and delete ??
@Javatechie4 жыл бұрын
Approach is same only you need to change query
@abdallaabuu66084 жыл бұрын
@@Javatechie I ment in the dao class, function to insert,update and delete and in controller in this example u tought us only select using list function Thanks
@thiemhoang65865 жыл бұрын
tks bro. I have some question. Now a my result is Array of Array. i want to convert it to Entity. Help me please
@Javatechie5 жыл бұрын
Didn't get you can you please elaborate it
@thiemhoang65865 жыл бұрын
@@Javatechie your result is Array. I want convert it to Json
@thiemhoang65865 жыл бұрын
sr bro. My english is not good
@Javatechie5 жыл бұрын
@@thiemhoang6586 just use ObjectMapper for example ObjectMapper mapper=new ObjectMapper (); mapper.writeValueAsString("pass your array here ");
@limnes.4 жыл бұрын
@@Javatechie thanks for your videos, my result is array too, where should put that code (objectMapper) in your example, thanks
@vaishnavideekonda3724 жыл бұрын
Hello. I have copied and pasted the code as it is from gitub. I have created table and two procedures as you created. But I am not able to fetch any data in the postman using get. I am getting status 500 . and in the console i got nullpointerexception. What could be the reason?
@Javatechie4 жыл бұрын
Debug it once you will get to know who causing this issue
@bhavanisankar71 Жыл бұрын
Sir how to save our entity variables in preserve order because in my entity i used Id,name, salary, address but db storing id, address, salary,name but i need id,name, salary, address how sir
@Javatechie Жыл бұрын
You need to add one key in application.properties like physicalNamingStrategy
@bhavanisankar71 Жыл бұрын
Please tell me full answer
@Javatechie Жыл бұрын
Did you search in Google what i suggested? If not please do it then ask
@bhavanisankar71 Жыл бұрын
@@Javatechie ok I will search if not possible i will tell you
@bhavanisankar71 Жыл бұрын
@@Javatechie i added PhysicalNaming strategy it is not working please do me one video short video also ok please sir 🙏
@manutyagi80192 жыл бұрын
Good afternoon sir, how can we call stored procedure in jsp using spring boot?
@nilolima54012 жыл бұрын
How i can create Stored Functions in Spring Boot?
@Javatechie2 жыл бұрын
That is what I explained in this video
@ranikanojiya73942 жыл бұрын
When one single store procedure have multiple query how to retrieve that data?
@RobertoSilvaZuniga6 жыл бұрын
Thank you, you know who I can create a Pagination with stored procedure?
@thiru532 жыл бұрын
Hello sir, Can you please help me to pass Java collection to Oracle Stored procedure List to Oracle Stored procedure as IN parameter
@Javatechie2 жыл бұрын
Let me check
@jasper50164 жыл бұрын
Can you try to pass this query to ThymeLeaf and check? It would not work because you get List and you are converting them to List type.
@rohithsuvvari56345 жыл бұрын
Hi sir, I am getting this error : java.lang.IllegalArgumentException: Named parameter [tcategory] is not registered with this procedure call. I wrote the same procedure call like you and same steps. What am I missing
@Javatechie5 жыл бұрын
Please compare with my code you can find your mistake.else do let me know
@rohithsuvvari56345 жыл бұрын
@@Javatechie This is the only missing line spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect This is giving error for me, hence I removed it. I am using MySQL 8. Could this be the root cause ? Rest all I followed exactly same.
@rohithsuvvari56345 жыл бұрын
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. This also I dropped, Nothing else.
@Javatechie5 жыл бұрын
@@rohithsuvvari5634 this is just warning you can ignore it . Check in procedure annotation
@rohithsuvvari56345 жыл бұрын
@@Javatechie It is actually a run time error only for this procedure where there input parameters. 2019-08-15 17:28:25.705 ERROR 1564 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Named parameter [t] is not registered with this procedure call; nested exception is java.lang.IllegalArgumentException: Named parameter [t] is not registered with this procedure call] with root cause java.lang.IllegalArgumentException: Named parameter [t] is not registered with this procedure call at org.hibernate.query.procedure.internal.ProcedureParameterMetadata.getQueryParameter(ProcedureParameterMetadata.java:125) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final] at org.hibernate.procedure.internal.ProcedureCallImpl.setParameter(ProcedureCallImpl.java:816) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final] at org.hibernate.procedure.internal.ProcedureCallImpl.setParameter(ProcedureCallImpl.java:69) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final] at com.example.practice015.storedprocedure.dao.ticketdao.getTicketinfo2(ticketdao.java:31) ~[classes/:na] at com.example.practice015.storedprocedure.dao.ticketdao$$FastClassBySpringCGLIB$$93ffe426.invoke() ~[classes/:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE] at com.example.practice015.storedprocedure.dao.ticketdao$$EnhancerBySpringCGLIB$$9ea46931.getTicketinfo2() ~[classes/:na] at com.example.practice015.storedprocedure.controller.ticketcontroller.findTicketsByCatgeory(ticketcontroller.java:31) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) [tomcat-embed-core-9.0.22.jar:9.0.22] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.22.jar:9.0.22] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.22.jar:9.0.22] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
@kaushiklad65515 жыл бұрын
In the response its giving array ....but my need id i want key value pair array ...and u are getting simple array how can i distinguished with json key value
@Javatechie5 жыл бұрын
kaushik , its very simple i missed it to mention in video ,in @NamedStoredProcedureQuery annotation just use one more attribute i.e resultClasses = Ticket.class example : @NamedStoredProcedureQueries({ @NamedStoredProcedureQuery(name = "firstProcedure", procedureName = "getTickets",resultClasses = Ticket.class)})
@kaushiklad65515 жыл бұрын
Thank u i try tomorrow
@kaushiklad65515 жыл бұрын
Yes i try today and it work...but Resulset class has no @id or primary key So i make some string column name as id .... So it result is duplicate of firsf row ... I try @generatedvalue(gnerationtype.auto) Still not work ... How can get data when i have no primary key in table or result
@mohammadkassir35453 жыл бұрын
How to convert the response to json ?
@Javatechie3 жыл бұрын
Its json only
@yogeshhivarkar98384 жыл бұрын
Hi sir , i want to insert data into oracle database in 7 different table with 7 diff store procedure so how ca do this using jpa .in one hit. please suggest the solution.......thanks in advanced
@Javatechie4 жыл бұрын
Need to check this
@yogeshhivarkar98384 жыл бұрын
@@Javatechie ok sir thanks
@SurajYadav-yd2cu3 жыл бұрын
i am getting entity manager as null can anyone help ?
@garikinarajesh13752 жыл бұрын
How to create procedure in h2 database
@Javatechie2 жыл бұрын
Not sure in h2 will check and update you
@garikinarajesh13752 жыл бұрын
@@Javatechie Could you please make a video on Ack,Nack and nackandreque in RAbbitMq Plz?
@nimeshaghera53724 жыл бұрын
How TO Retrieve Data in JSON Format with paramere name?
@Javatechie4 жыл бұрын
Return retrieve object from controller directly else use objectmapper class to convert it to object
@wangjamdevendra83386 жыл бұрын
how to display the output in html table ?? please show
@Javatechie6 жыл бұрын
Hi wangjam, Please check my yahoo stock api video description there i shared one link where I displayed data in html in tabular format
@ajithdas21277 жыл бұрын
What is lamboc bro
@Javatechie7 жыл бұрын
Lombok is a tool through which we can generate setter,getter,constructor,toString methods automatically using annotation , we no need write those common logic manually Please refer my blogs : javagyanmantra.wixsite.com/website/single-post/2018/02/11/How-to-configure-Lombok-in-eclipse
@sridharans22304 жыл бұрын
Work on your spellings
@soboko1234 жыл бұрын
Spellings are irrelevant to what he is teaching. You are watching this to learn spring , not to learn English.
@fragaeverton3 жыл бұрын
And you work on your gratitude. This guy is trying to help us and you´re complainnig.
@subhrajeetmitra36812 жыл бұрын
java.sql.SQLSyntaxErrorException: PROCEDURE ticket.firstProcedure does not exist - I am getting this. Can you explain why
@KarlGernanz Жыл бұрын
@Autowired private EntityManager em; --> Could Not Autowire.No beans of 'EntityManager' type foun d😪
@Javatechie Жыл бұрын
Did you define entity manager as a bean in config class
@KarlGernanz Жыл бұрын
@@JavatechieCould you explain how? please.
@Javatechie Жыл бұрын
I have already explained in video buddy
@KarlGernanz Жыл бұрын
@@Javatechie Perfect, It Works .. Thanks a lot!!! Blessings 💯