0
我有一个Entity
类,其中包含Set<Another Entity>
映射到它,我保存它。现在我可以通过entity.getId()
获得实体的ID,但我需要获得set<anotherEntity>
的ID。 有没有办法让他们直接保存后?有没有办法在休眠状态下获取Set <Entity>的ID?
我有一个Entity
类,其中包含Set<Another Entity>
映射到它,我保存它。现在我可以通过entity.getId()
获得实体的ID,但我需要获得set<anotherEntity>
的ID。 有没有办法让他们直接保存后?有没有办法在休眠状态下获取Set <Entity>的ID?
List<Long> allIds = set.stream().mapToLong(e -> e.getId())
怎么样?