Skip to content
Advertisement

Tag: spring-data

Java spring userRegister creates two database entries instead of one

As above this creates two database entries in user table. The process should be following: a new user enters their email and password -> saved in login table user confirm Email address -> entry in user table with username (email) and first&second name should be null at first. For second the code would be like that (working) is returning {“answer”:”done”,”username”:null}

Apache Ignite 2.11.0 :: Missing ignite-spring-tx-ext in maven repository

We are trying to upgrading from 2.9.1 to 2.11.0 and we have already using org.apache.ignite.transactions.spring.SpringTransactionManager which is now not available in core lib, when we checked docs https://ignite.apache.org/docs/latest/extensions-and-integrations/spring/spring-tx#maven-configuration its suggesting to use ignite-spring-tx-ext. But when we used that in pom.xml, its repository dose not exist in Maven repository. Can some please help us how to solve this. Answer Starting from

I get empty list from findAll Spring data and h2 data base while the database is not empty

I have a spring boot API project with h2 database. I added some data in the data.sql but the data wasn’t inserted into the database however tables are created successfully when I call the findAll API I get an empty list due to the database tables are empty. Application.properties data.sql Pom.xml Main Class Gateway.java Repository Controller project structure Answer Add

How to handle an error when database returns null value for one of the columns in the table

I’m using Java and Spring Boot with JPQL to access the data. I’m getting the below error because hourlyRate is null in the database: Caused by: org.hibernate.QueryException: could not instantiate class [com.example.model.response.school.Employee] from tuple. I still would like to be able to get the data from the database even when that column has null value in the database and send

Spring Elasticsearch sorting by field with whitespace

I need to sort my documents by some fields, one sorting – one field. But every time I’m getting wrong sorting. In document I have uid and title. Uid in document looks like ‘AAA-100’ and title could be just a text with spaces. And when i’m trying to sort by those fields i’m getting wrong order. For example when i’m

Null repository even with @Autowired implemented

I have the following controller. The following line works just fine: user = userRepository.selectUserByLogin(name); It correctly returns the user. Now I want to move that code to a getLoggedUser method of a “Utilities” class. This is how I did it. Controller Utilities But when that is executed I’m getting the following error: Cannot invoke “UserRepository.selectUserByLogin(String)” because “this.userRepository” is null. Why

Records appear to be locked between sequential database operations (Spring Data, Hibernate)

I’m experiencing what seems to be a record lock between sequential (not concurrent) database operations, which I can’t explain. Situation Method saveRegistrationToken is called from a REST controller. I test the calls to the method via Postman (HTTP client); the method is not called anywhere else, this is the only operation executed. The method execution is supposed to behave as

Mongo aggregate sum of two Strings

I am trying to sum one field in Mongo. If it is an Integer there is no issue, but the problem is that it is String and I get 0 for totalAmount amountField is a String, how can I sum it in this implementation Answer You are getting String amountField. Simply you can convert this String to Integer by using

Spring boot / Java, mongodb SSL / TLS connectivity

I have two projects where I use spring boot + mongodb. In one project the spring boot version is 1.4.1.RELEASE and other project is 2.1.3.RELEASE. I have certificate(s), key in PEM format to onboard into truststore and keystore – One server certificate chain and other a client certificate and private key. I programmatically load the certificates into truststore and keystore.

Advertisement