postgresql异常运算符不存在:uuid = bytea

时间:2017-12-11 09:04:42

标签: postgresql spring-boot uuid

您好我的春季启动postgresql应用程序我想执行以下的SQL查询。

 SELECT
                o.id as projectId,
                o.name as projectName,
                stld.name || ' ' || pe.firstname || ' ' || COALESCE(pe.middlename , ' ') || ' ' || pe.lastname as employeeName,
                pemp.description as description,
                pemp.actualstartdate as actualStartDate,
                pemp.actualenddate as actualEndDate
            FROM Con_project o
                LEFT JOIN con_project_employee pemp on o.id = pemp.projectid
                LEFT JOIN employee pe on pemp.employeeid = pe.id
                LEFT JOIN system_type_lookup_data stld on stld.id=pe.TITLEID
            WHERE  
                pemp.employeeid = :employeeId  OR pemp.projectid = 
               :projectId

控制器

 @RequestMapping(value = "/employeeproject", method = RequestMethod.GET)
    @ResponseBody public Page listEmployeeProject(@RequestParam UUID projectId, @RequestParam UUID employeeId, @RequestParam Integer page, @RequestParam Integer size) {
       profileService.findEmployeeProject(projectId, employeeId, new PageRequest(page, size));
        return null;
    }

当我执行查询时,我得到以下错误。控制器中没有employeeId和projectId,我需要在没有任何过滤器的情况下获取员工项目。

.14:15:07.156 [http-nio-6062-exec-9] WARN  o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 42883 
.14:15:07.156 [http-nio-6062-exec-9] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: operator does not exist: uuid = bytea
  Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

的DDL

     CREATE TABLE employee
    (
      id uuid NOT NULL,
      createdby uuid NOT NULL,
      createddatetime timestamp without time zone NOT NULL,
      entity_status integer,
      updatedby uuid,
      updateddatetime timestamp without time zone,
      version bigint,
      age integer,
      code character varying(50),
      dob timestamp without time zone,
      email character varying(255),
      firstname character varying(300),
      lastname character varying(300),
      middlename character varying(300),
      mobile character varying(255),
      employee_id character varying(255),
      joined_date timestamp without time zone,
      qualification character varying(255),
      orgid uuid,
      genderid uuid,
      maritalstatusid uuid,
      nationalityid uuid,
      titleid uuid,
      CONSTRAINT employee_pkey PRIMARY KEY (id),    
      CONSTRAINT uk_nbyivu8qgmx0r7wtbplf01gf8 UNIQUE (code)
    );
    CREATE TABLE con_project
    (
      id uuid NOT NULL,
      createdby uuid NOT NULL,
      createddatetime timestamp without time zone NOT NULL,
      entity_status integer,
      updatedby uuid,
      updateddatetime timestamp without time zone,
      version bigint,
      code character varying(255),
      description character varying(250),
      name character varying(100),
      actualenddate timestamp without time zone,
      actualstartdate timestamp without time zone,
      plannedenddate timestamp without time zone,
      plannedstartdate timestamp without time zone,
      projectvalue double precision,
      orgid uuid,
      customerid uuid,
      projectmgr uuid,
      CONSTRAINT con_project_pkey PRIMARY KEY (id),
      CONSTRAINT fklhj0vjp9kg5ailryr38s8kbvr FOREIGN KEY (projectmgr)
          REFERENCES public.employee (id) MATCH SIMPLE
          ON UPDATE NO ACTION ON DELETE NO ACTION
    );

CREATE TABLE con_project_employee
(
  id uuid NOT NULL,
  createdby uuid NOT NULL,
  createddatetime timestamp without time zone NOT NULL,
  entity_status integer,
  updatedby uuid,
  updateddatetime timestamp without time zone,
  version bigint,
  actualenddate timestamp without time zone,
  actualstartdate timestamp without time zone,
  description character varying(255),
  orgid uuid,
  employeeid uuid,
  projectid uuid,
  projectempstatus uuid,
  CONSTRAINT con_project_employee_pkey PRIMARY KEY (id),
  CONSTRAINT fk2dwlm099cuqdy0aoqh8xnxijs FOREIGN KEY (employeeid)
      REFERENCES public.employee (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fkj2my042i5v8kk3h4qq96m2cl1 FOREIGN KEY (projectid)
      REFERENCES public.con_project (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
);

1 个答案:

答案 0 :(得分:1)

projectIdemployeeIdnull时,PG告诉您SQL无效。

相关问题