JPAUpdateClause with Join

1

I have the following entities:

@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(schema = "MYDB", name = "TB_TESTE")
public class Teste implements Serializable {

    @ManyToOne
    @JoinColumn(name = "CO_TIPO_TESTE")
    private TipoTeste tbTipoTeste;

    @Column(name = "ST_REGISTRO_ATIVO")
    private String stRegistro;

}

@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(schema = "MYDB", name = "TB_TIPO_TESTE")
public class TipoTeste implements Serializable {

     @Column(name = "TP_ARQUIVO")
     private String tpArquivo;

}

I need to update the Test table based on an attribute from another table. I expected the following code to generate an update with join.

JPAUpdateClause update = new JPAUpdateClause(em, QTeste.teste); update.where(QTeste.teste.tbTipoTeste().tpArquivo.eq("X")); update.set(QTeste.teste.stRegistro, 'N'); update.execute();

However, the following SQL was generated:

update MYDB.TB_TESTE cross join set ST_REGISTRO=? where TP_ARQUIVO=?

The generated SQL has only one of the tables needed to do Join, and when executed it gives the error ORA-00971: SET keyword not found. How can I join in the update in another way?

    
asked by anonymous 28.07.2016 / 19:40

0 answers