Update problem on oid field


I have a problem when I do my update because of the type of image field which is apparently in ‹ OID ›, how should I do so that my update passes? Please. Thanks

 UPDATE project_project_task 
    SET photo = [B@67806ea8,	
     FROM project_number_test AS t2 
    WHERE t2.id = 1

I got this error at runtime :

ERROR: ERREUR:  erreur de syntaxe sur ou près de « [ »
LINE 4: photo = [B@67806ea8,

what are you achieving in this? you don’t have to write this query mostly

I just want to update all the fields of a task that would have the same task number.


I think you want to advise me to use JPA / JPQL queries? Do you have an example for an update? With a Where filter.
If that’s what you’re suggesting? Of course, otherwise tell me what you advise me. Because I don’t think I’m using good practice…

all fields of same task?? or photo field for all tasks

I am not still not getting use case, how are you getting photo field value?? you wrote this query ?

All field of the same task? after I would do treatment to perform an update it is necessary

Yes I wrote the select query to get the photo, which is a binary, there I tried to do that but I don’t know if it’s a good practice, I would need an example already to use JPA. Which would allow me to recover my entities so that I could then update them in java processing as a result.

Should I extend like this? To use JPA? and avoid making native queries ?

public class OrderedTaskServiceImpl extends ProjectTaskRepository

public List search(ProjectTask projectTask) {

  List<ProjectTask> listeProjectTask = super.all().fetch();
	return listeProjectTask;

Actually tell me how i can use entityManager declare it and use it after i think i can manage. Thanks

It’s good I found by looking in existing code, in fact you always have to go through the repository.

Thanks anyway for your time Siddique

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.