Skip to content
Advertisement

Tag: spring

how do i save a new student that contains entities, but don’t create these entities because they already exist in the database?

I want to save a student and a student has a TargetAudience object as an attribute. These target audiences are allready hardcoded in my database. (targetaudience = campus + major). Now when i post like this: it doesnt work because everythime it creates a new object for the campus and because i use name as a primary key it throws

Create relationship between 2 tables JPA

Need help with setting up table relationships. So, there are 2 entities – Section and Period. 1 Section has many Period, but 1 Period do not belongs to any specific Section. I implemented this relationship as follows: created an additional table SectionCodes with an external key on Section (more in diagram) Section class: SectionPeriod: This works fine, but there is

Order by 2 columns with case

I have a query that searches for user in 2 colums firstUser and secondUser and orders them by first and last name: But this first orders the cases when user is at first user then it orders the case when user is secondUser. Is ther a way to order the whole data by first name and last name no matter

Is NamedParameterJdbcTemplate vulnerable safe?

We are using NamedParameterJdbcTemplate to achieve “IN” operator functionality. Is there any SQL Injection vulnerability when we use NamedParameterJdbcTemplate? Answer Since NamedParameterJdbcTemplate internally use PreparedStatement for querying , and if you can make sure that you do not build the SQL query by somehow concatenating the input from the user , but using the placeholder :xxxx to specify their value,

Error starting Tomcat context.Exception: org.springframework.beans.factory.BeanCreationException.Message:Error creating bean with name ‘h2Console’ def

I have this simple CRUD Spring HTTP Service (see ). I would like to achieve something like . I made use of Thymeleaf and 2 html files: add-edit-employee.html and list-employees.html. Initial data comes from an sql table: data.sql & schema.sql. When I run the project I get error: Log of the errors 2 Pom file application.properties EmployeeEntity class data.sql schema.sql

Boolean value not being changed in database

Hey folks I’m having a problem with my code. For some reason when I try to change the value to false, it doesn’t reflect in my SQL Database. I debugged and it does get set via Java, but it doesn’t transfer over. I’m working on a notification service class and it sets the values on there to true no problem,

JpaRepository SQL syntax error when trying to save to MySQL Date

I have the following row in my MySQL Table: https://i.stack.imgur.com/u0FC4.png This column is represented as: And it is bound to a Thymeleaf form like so: Now if I insert a date into the MySQL db directly, the date is loaded and set to the correct date on the form: https://i.stack.imgur.com/e35lr.png But every time I try to save or edit the

Advertisement