Imdg.insert return id

This commit is contained in:
AKurakin 2023-04-05 13:23:52 +03:00
parent 316e2fe042
commit c8306a1f7f
3 changed files with 5 additions and 3 deletions

View file

@ -40,11 +40,12 @@ public class ImdgHazelcast<T extends SpcexObjectBase> implements Imdg<T> {
}
@Override
public void insert(T paramT) {
public Long insert(T paramT) {
if (paramT.getId() == null) {
paramT.setId(idGenerator.newId());
}
map.put(paramT.getId(), paramT);
return paramT.getId();
}
@Override

View file

@ -25,11 +25,12 @@ public class ImdgTransactionalHazelcast<T extends SpcexObjectBase> implements Im
private HazelcastInstance hzInstance;
@Override
public void insert(T paramT) {
public Long insert(T paramT) {
if (paramT.getId() == null) {
paramT.setId(idGenerator.newId());
}
map.put(paramT.getId(), paramT);
return paramT.getId();
}
@Override

View file

@ -12,7 +12,7 @@ public interface Imdg<T extends SpcexObjectBase> {
throw new UnsupportedOperationException("not implemented name");
}
default void insert(T paramT) {
default Long insert(T paramT) {
throw new UnsupportedOperationException("not implemented insert");
}