0

I'm having trouble with the error: Already had POJO for id in my service.

I have a method that expects a list of entities, and I'm passing objects to it.

My entity class is defined as:

@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@asset_id", scope=Asset.class)
public class Asset extends BaseEntity implements Serializable {

When I send the objects, I am sending them with all properties filled out but with no @asset_id defined.

When I get the list of items out of the db, it is like this:

[{ "@actor_id": 1, "id": 1, "name": "Test" }]

When I send it back, I send this

[{ "id": 1, "name": "Test" }]

Why am I getting this error? If I leave the @actor_id in I get the error too. I can't figure it out.

mikeb
  • 10,578
  • 7
  • 62
  • 120

1 Answers1

2
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class,property="@id", scope=Asset.class)

This might solve your problem.

Joe Taras
  • 15,166
  • 7
  • 42
  • 55
Danda
  • 380
  • 1
  • 2
  • 14