sql >> Base de Datos >  >> RDS >> Mysql

JPA eclipsa dos claves foráneas @IdClass errores de implementación

El valor de Idclass no debe ser la misma clase de Entity 'SaleDetails'

    @Entity
    @IdClass(PK.class)
    public static class SystemUser{
        @Id
        private String subsystem;

        @Id
        private String username;

        public PK getId(){
            return new PK(subsystem, username);
        }

        public void setId(PK id){
            this.subsystem = id.subsystem;
            this.username = id.username;
        }
    }

    public static class PK implements Serializable {

        private String subsystem;

        private String username;

        public PK(String subsystem, String username) {
            this.subsystem = subsystem;
            this.username = username;
        }
    }