3

I have an error regarding deploying the backend trough docker on localhost 8080 .

When i run the website normally (started the postgres server from inteliji) it works properly.

When i try to deploy it trough docker i get the following error:

org.postgresql.util.PSQLException: ERROR: operator does not exist: uuid = bigint
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 580

The next code is an example of class using UUID

package com.ds.assignment1.ds2021_30244_rusu_vlad_assignment_1.entity;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.UUID;

@Entity
@Data
public class Account {
    @Id
    @GeneratedValue(generator = "uuid4")
    @GenericGenerator(name = "uuid4", strategy = "org.hibernate.id.UUIDGenerator")
    private UUID id;
    private String username;
    private String password;
    private String role;
}
AverageSoul
  • 85
  • 2
  • 6
  • The error message is explicit : your sql code tries to test an equality between a data of type uuid and a data of type bigint, which is not allowed. You have to correct your sql code or display it if you need any help. – Edouard Nov 11 '21 at 19:57
  • i kow this is the problem ,i dont know how to solve it because i worked with jpa so i didnt write any specific queries. – AverageSoul Nov 11 '21 at 19:58
  • The error points at position 580 of your code. Diffiult to help if yo can't share the code. – Edouard Nov 11 '21 at 20:14
  • Check the schema of your postgres database table, I guess the `id` column of your table is of type bigint. – Andreas Nov 11 '21 at 20:16
  • i checked and the data type is uuid – AverageSoul Nov 11 '21 at 20:18
  • 3
    The issue is that in whatever query is executing at line 580 is doing something like: `id = ` where `` is an `integer`. You will need to track down why is being assigned an `integer`? – Adrian Klaver Nov 11 '21 at 21:55

1 Answers1

1

The error shows that the database column is UUID whereas the JPA entity is bigint. I should mention that this may be or may not be about the ID field of this entity.

As @Adrian-klaver said you have to look at position 580 of the SQL query, which you can do by enabling hibernate query logs and looking at the last hibernate SQL query log.

I had a similar problem, spending three days to finally resolve it. My problem was due to having multiple attribute types being different than their database type. As I was migrating from Long id to UUID, it made me confuse figuring out what the cause for my error was.

M at
  • 1,020
  • 1
  • 12
  • 26