Imdg.insert return id
This commit is contained in:
parent
316e2fe042
commit
c8306a1f7f
3 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue