All Questions
505 questions
0
votes
0
answers
18
views
Java Spring Multi Role Authauthentication Authorization Error For One Role
package com.codecraft.Crud_app.service;
import com.codecraft.Crud_app.model.Task;
import com.codecraft.Crud_app.repository.TaskRepository;
import lombok.RequiredArgsConstructor;
import org....
0
votes
0
answers
76
views
Instead of updating, a new post is being created
I'm working on a small CRUD site, and I ran into a problem: when trying to update an existing post, a new one gets created instead of modifying the existing one.
The ID is being passed correctly, I’ve ...
1
vote
0
answers
25
views
How to solve Controller integer parameter could not solve problem
Language: Java
Framework: Spring Boot, MyBatis, MySQL
I have been trying to add like service to my board service. It succeeded it. However, I'm trying to use userNo and boardNo to establish disable ...
-1
votes
1
answer
52
views
Delete Method in CRUD operation in Spring Bo
I have been trying CRUD Operation for my spring boot.
I have to delete the row by given name in delete() method. I need some guidance to get this working. I debugged the code but it returns 500 error ...
1
vote
1
answer
55
views
How to find objects using JpaRepository with multiple non-requiered request parameters?
I need to find some objects for all 3 non-required parameters from request with pagination:
@GetMapping
public ResponseEntity<List<Book>> getBooks(@RequestParam(value = "name", ...
0
votes
0
answers
26
views
The method save(Iterable<S>) in the type MongoRepository<Blog,String> is not applicable for the arguments (Blog)
After following a lot of online articles about starting up a CRUD app with Java/Mongo, I am seeing this error. I did a lot of iterations, but cannot figured it out...
Blog Model
import lombok....
0
votes
0
answers
21
views
Hateoas RepresentationModelAssembler removes *some* values not annotated with @JsonIgnore from reponse
I'm trying a GET request that uses hateoas RepresentationModelAssembler in Spring Boot project with this method:
@GetMapping("/{postId}")
public EntityModel<Post> one(@...
0
votes
1
answer
327
views
Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
Having a run error in VS code
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-05-04T20:04:39.029-07:00 ERROR 27384 --- [...
0
votes
0
answers
40
views
Springboot CRUD operation can not be edited
I created a CRUD project with Springboot. There is a relation table that is called order and it has relation with tables which are called Customer and Product. In my html page , there are labels for ...
1
vote
1
answer
97
views
Gitlab ci won't run my scripts as it requires a database connection
I’m attempting to run a unit test within gitlab, the test functions correctly on my local enviornment but I encounter the error below in Gitlab.
I'm guessing gitlab does not have access to the ...
0
votes
0
answers
77
views
"Cannot be resolved as a type" problem with Java
package br.com.agenda.factory;
import java.sql.Connection;
import java.sql.DriverManager;
public class ConnectionFactory {
//nome do usuário do mysql
private static final String ...
0
votes
2
answers
74
views
Having problems saving an object in Hibernate
Maybe a trivial problem, but I looked through everything I could and couldn’t find a solution
I’m trying to save a new GeologicalClass using a post request (not the best naming, but that’s the task), ...
0
votes
0
answers
65
views
Failed to load ApplicationContext when trying to build a SpringBoot CRUD application
I created a simple CRUD application using Spring but when I try to build it using mvn clean install, it throws the following error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-...
0
votes
2
answers
58
views
Should I create the update function for every attribute, or should I allow partial updates?
How should the updating process be implemented? Is it advisable to have an obligatory update for all attributes (First Example), or should I add null check conditionals to allow partial updates (...
0
votes
1
answer
66
views
Error to execute simple CRUD in java with oracle
guys.
The code below don't work.Accuses error.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class Main {
public static void main(String[] args) ...
0
votes
0
answers
51
views
Best Practices for Organizing Java Classes in a Spring Application using JPA for CRUD Operations?
We are currently developing a Java application utilizing CRUD methods with JPA within the Spring framework. Our codebase comprises various classes, including entity classes representing database ...
-1
votes
1
answer
82
views
Spring CRUD dont save entity to database
My spring application don't add any data to connected H2 Database.
It's my Patient entity:
package medical.Model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import ...
0
votes
1
answer
138
views
Lombok annotation import problem in spring boot controller
I'm trying to do a CRUD with spring using the h2 database and lombok, and it's giving me an error like this:
java.lang.IllegalArgumentException: The given id must not be null
My controller:
package br....
0
votes
0
answers
389
views
How do I fix the following issue: Could not write JSON: Failed making field 'java.lang.ThreadLocal#threadLocalHashCode' accessible?
I am trying to build the Create section of a CRUD Watchlist API in spring boot for an assignment. I need to store my data in a json file instead of a database, to serialize and deserialize I'm using ...
-1
votes
1
answer
231
views
Android Room library. Cannot access database on the main thread
I have a SQLite local database with implemented Room library.
Local database creates when i complilate project.
Tried to build project and got this:
java.lang.RuntimeException: Unable to start ...
0
votes
2
answers
135
views
Everything is correct, but it shows 404 error
I create a normal POST, GET mapping in spring boot. It successfuly connected to the database(PostgreSQL).
then, I want to try this in postman tool, but it shows error 404. How to solve this?
I tried ...
0
votes
2
answers
726
views
Spring Boot JPARepository .save() method inserts a new row when updating an enum attribute
I'm working with Spring Boot 3 and using JPARepository to manage my database operations. I've encountered an unexpected behavior when attempting to update an entity's enum attribute.
Scenario:
I fetch ...
0
votes
0
answers
135
views
How do I insert values into two tables using Springboot?
I have two entities, namely Team and Player. I am very new to Springboot and only followed a video with how to make a basic crud api. However, I am having trouble with creating records with regards to ...
0
votes
0
answers
85
views
Deleting item with jdbc from table with relations
im writing application using jdbc and not using JPA methods. Somehow i cannot find sources and a way how to operate with relations. In this case i want to delete item in one table which has one-many ...
0
votes
0
answers
67
views
Patch Method Not Updating The Changed Field on File
I am trying to update the fields of a very large entity with the patch method. I want to update only certain fields instead of updating the whole file. Even if the request I sent returns as 200, the ...
2
votes
2
answers
1k
views
Java spring JPA : Method 'PUT' is not supported
I have following problem. I just wanted to do a simple update request to my postgresql database.
But I always get following error code, if I try to test the request with Android Studio.
{
"...
0
votes
0
answers
123
views
How to make Vaadin Crud Editor window remain on screen once save is clicked?
I created vaadin crud component and its editor. When user clicks the row, editor opens automatically. Then if user makes change and clicks save, editor window closes automatically. Everything is fine ...
0
votes
0
answers
27
views
How to change object field (status) by button (HTML) and stay in the same page?
I would like to change the status field from current "ToDo" to "InProgress".
HTML:
<div>
<div class="card-inner" th:if="${project.status.toString()=='...
-1
votes
1
answer
1k
views
What is the correct approach to update only specific fields in Spring Boot using Spring Data JPA repository?
I just want to update just some field.
For example; just name or password or gmail but when ı try to add just one field, other datas is being recorded null. How can ı solve this problem? Should ı try ...
0
votes
0
answers
67
views
How to exclude dirty tracker from binder for one component (text field) in Vaadin?
I have crud and its editor. Crud editor is a dialog includes textfield and checkbox. Whenever I change the content of textField, the crud editor dialog enables its save button in toolbar. I know if I ...
0
votes
1
answer
39
views
findOne() returns value from form
I'm trying to do a login and for that I'm using the findOne method in the CrudRepository. The thing is that, if the user and password in the db is "admin" and "admin" (for example),...
0
votes
2
answers
763
views
Error 404 Not Found on POST request with my Spring Boot CRUD login & registration app on Postman
I made a user login & registration app on spring boot, it runs successfully without any error but displays the error "404 Not Found" when I do a POST request on POSTMAN. Why is it so, ...
1
vote
3
answers
1k
views
How to update a detached entity containing the ID with hibernate EntityManager?
I am developing a REST API with Quarkus and Hibernate. I now have to create an endpoint which accepts a PUT request to update an existing entity. The request contains the entire entity, with its ...
2
votes
2
answers
121
views
How can I fix Spring boot POST API's 500 error?
I created POST API in Spring Boot, but 500 error occurs.
"timestamp": "2023-01-27T16:27:32.609+00:00",
"status": 500,
"error": "Internal Server Error"...
0
votes
2
answers
33
views
Provide security in Spring
I am developing a basic crud web app in react and spring.
I am Testing with postman, as frontend is not ready yet.
I have this method, but i just discovered that anybody knows the id can send a HTTP ...
1
vote
1
answer
1k
views
When should I use starter web and starter webflux dependency in Spring Boot?
starter web and starter webflux dependency in Spring Boot. I am fall in dilemma. Please let me know what is the differences both of these. When, how, where should I used it? how to CRUD using both, ...
0
votes
0
answers
113
views
Vaadin Exception - Couldn't find the definiton of the element with tag "vaadin-crud" in any template file declared using '@JSModule' annotations
My vaadin error - Couldn't find the definiton of the element with tag "vaadin-crud"
When I try to run my web application which use vaadin crud operations that pro subscription is paid, I am ...
0
votes
0
answers
43
views
Why is Only One Object Appearing in my Database? (Using Spring and MongoDB)
I am working on an ecommerce website using Eclipse, Spring, and MongoDB. Whenever I try creating a new category (URL is http://localhost:8080/admin/categories), the first one appears, but when I try ...
1
vote
0
answers
389
views
How would I go about Creating a ShoppingCart inside of an Ecommerce Website (using Eclipse and MongoDB)
Lately, I have been working on an ecommerce website. So far, I have a basic POJO called "Product" which is supposed to represent each individual product for sale. I also have a ...
0
votes
1
answer
122
views
DynamoDB not fetching all entries in case of two autogenerated attributes
I have a crud application which uses DynamoDb, it has a model class containing two autogenerated attributes, one for primary key and another for timestamp.
I am using scan() function of DynamoDbMapper ...
-1
votes
2
answers
1k
views
Use @Before in service for all methods in Java [duplicate]
I am implementing a service for my controller in java. This service implements an interface with several methods, where each of them performs a different logic. However, they also have a common logic (...
0
votes
0
answers
28
views
Java Springboot Unit-Testing
Building a UnitTest into a CRUD Application
I tried adding a hardcoded business item as variables to the Application.Unit TestComponent class Controller Classoutput
0
votes
1
answer
639
views
Angular Local Storage Delete Not Removing item
Hello I am learning angular and I'm working on a todo app that stores to local storage. Getting the local storage to remove a single item as well as editing an item has been a challenge and I've not ...
0
votes
1
answer
360
views
How can I pass an object array to a method in another class so this method uses it as a normal array?
I am pretty new to java and programming in general so sorry if I confuse some concepts, in my code I have an object called cr which is an array in the class Menu constructed from the class ...
0
votes
2
answers
769
views
@DeleteMapping not working. Error message: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported
So I have to make a CRUD application and when run on postman, the error being shown is 405, Method not allowed. Upon trying "spring.mvc.hiddenmethod.filter.enabled: true" in the application....
1
vote
1
answer
680
views
Update User details endpoint returns 405, "error": "Method Not Allowed",
I'm trying to update the detail of an existing user in the member table but when I tried to test the endpoint using postman it returned a 405, "error": "Method Not Allowed",. I ...
1
vote
0
answers
171
views
How to update row by id in jdbc?
I am trying to update a row in mysql database by the id of the row, but it isn't inputting the new values into the database. I have tried to tinker with the code but I just can't figure it out. I test ...
0
votes
1
answer
374
views
Cannot load configuration class: net.guides.springboot2.crud.Application Error in JPA spring boot
Here is a complete error log
2022-10-25 18:11:09.510 INFO 12252 --- [ main] net.guides.springboot2.crud.Application : Starting Application on DESKTOP-L7QADCR with PID 12252 (C:\Users\Seema\...
2
votes
1
answer
564
views
Why does this native query work when hardcoded but not with @Param?
I'm trying to run the following query
select * from Person where name || '|' || age in ('Fred|19','Sam|17','Chris|20')
Code using JPA
public interface PersonRepository extends JpaRepository<Person,...
-2
votes
2
answers
128
views
How can I add Edit (Crud) functionality with Java?
I want to create add an edit functionality (public void EditPatientData()) to edit the patients surname, firstname,
dateOfBirth, Length and weight. In other words I want to be able to edit the ...