Skip to content

Commit 046c249

Browse files
committed
[backend] fix(agents): fixed an hibernate detached issue when trying to fetch tags from an endpoint
1 parent 040f4e7 commit 046c249

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

openaev-api/src/main/java/io/openaev/service/EndpointService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ public Endpoint updateEndpoint(
320320
* @param existingAgents in the database
321321
* @return OpenAEV agents
322322
*/
323+
@Transactional
323324
public List<Agent> syncAgentsEndpoints(
324325
List<AgentRegisterInput> inputs, List<Agent> existingAgents) {
325326
List<Agent> agentsToSave = new ArrayList<>();
@@ -418,6 +419,9 @@ public List<Agent> syncAgentsEndpoints(
418419
if (executor != null) {
419420
for (Asset asset : endpointsToSave) {
420421
if (asset instanceof Endpoint ep) {
422+
if (ep.getId() != null) {
423+
ep = this.getEndpoint(ep.getId());
424+
}
421425
addSourceTagToEndpoint(ep, executor);
422426
}
423427
}

0 commit comments

Comments
 (0)