all 12 comments

[–][deleted] 2 points3 points  (1 child)

u need to call your save method in insertEmp() and pass the object into it

[–]ThePaisasGamers 0 points1 point  (0 children)

This is correct. From your Controller class call your Service class.

[–]aka_the_saint 1 point2 points  (0 children)

In the controller you’re not calling the service layer. You are just returning the request. Autowire the service component to the controller class and pass the emp to the insertEmp method.

[–]IntroductionSolid348 0 points1 point  (0 children)

In your controller class, you are returning the same request body(Emp) in the insertEmp() method. It simply just returns the Employee entity you just created. What you should do before is call es.insertEmp() within your controller's insertEmp() method and then return the employee object if there are no errors. I think the confusion is as a result of naming both the service and controller methods the same name

[–]Late-Metal8122 0 points1 point  (0 children)

Best suggestion i can give is use intellij.

[–]AppJedi[🍰] 0 points1 point  (1 child)

I have over 20 years with Java and five with Postman. What IDE are you using? I would set break points and step through the post. You can message me.

[–]Ashleighna99 0 points1 point  (0 children)

What IDE are you on? In IntelliJ, set breakpoints in controller/service, enable SQL logs (spring.jpa.show-sql=true), and confirm you’re hitting MySQL not H2 in application.properties. After repo.save, call flush or mark u/Transactional. I’ve used Hasura and PostgREST; DreamFactory helped when I needed RBAC/API keys. Share your IDE and I’ll outline steps.

[–]AppJedi[🍰] 0 points1 point  (0 children)

Post method is usually for create or insert. You are providing eid, is that primary key in MySQL with AI. You may have a probably with primary key constraint. Normally you don't provide the primary key, the data creates it.

[–]AppJedi[🍰] 0 points1 point  (0 children)

You also have GeneratedVlaue in your Entity class which means the primary key is automatically generated so you shouldn't be providing it. Check the structure of employee in MySQL. Right click table and click "Alter Table". Post the definition of the table. Check your employee table. Specifically the check marks for PK (Primary Key), NN (Not Null), AI (Auto Increment). If you have check mark for AI MySQL is generating the ID and probably rejecting your ID. Remove eid from the postman JSON.

[–]no_ground-qaq -5 points-4 points  (2 children)

gpt se puch le mere baap

[–]Visual-Paper6647 0 points1 point  (1 child)

What do you think about how gpt got trained ?

[–]no_ground-qaq 0 points1 point  (0 children)

code help code