【发布时间】:2018-01-10 17:54:55
【问题描述】:
我想使用 Speedment ORM 从两个表中选择字段,并通过 System.out.println 显示寄存器。
这是我的主要查询:
return AMDB.INSTANCE.interface_Manager().stream().filter(Interface_.INTERFACEID.contains(s))
.map(AMDB.INSTANCE.abstractcomponentManager().finderBy(Interface_.INTERFACE_COMPONENT_E_ID))
.flatMap(AMDB.INSTANCE.concretecomponentManager().finderBackwardsBy(Concretecomponent.ABSTRACTCOMPONENT_E_ID))
.map(cc -> cc.getConcretecomponentCamCamid())
.collect(Collectors.toList());
我想从不同的表中获取/选择字段:
StreamComposition.concatAndAutoClose(
AMDB.INSTANCE.interface_Manager().stream().filter(Interface_.INTERFACEID.contains(s))
.map(i -> i.getInterfaceid()),
AMDB.INSTANCE.interface_Manager().stream().filter(Interface_.INTERFACEID.contains(s))
.map(AMDB.INSTANCE.abstractcomponentManager().finderBy(Interface_.INTERFACE_COMPONENT_E_ID))
.map(ac -> ac.getComponentname()),
AMDB.INSTANCE.interface_Manager().stream().filter(Interface_.INTERFACEID.contains(s))
.map(AMDB.INSTANCE.abstractcomponentManager().finderBy(Interface_.INTERFACE_COMPONENT_E_ID))
.flatMap(AMDB.INSTANCE.concretecomponentManager().finderBackwardsBy(Concretecomponent.ABSTRACTCOMPONENT_E_ID))
.map(cc -> cc.getConcretecomponentCamCamid())
).forEachOrdered(System.out::println);
也许是:
SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id
或
从表 1、表 2
我找到了一种方法:
Map<Abstractcomponent, List<Interface_>> map0 = AMDB.INSTANCE.interface_Manager().stream().filter(Interface_.INTERFACEID.contains(s))
.collect(Collectors.groupingBy(AMDB.INSTANCE.abstractcomponentManager().finderBy(Interface_.INTERFACE_COMPONENT_E_ID)));
但我想使用值Map<String, List<Interface_>>, 实现最后一个连接表中的字段,其中“字符串是来自“concretecomponentManager”表的字段
【问题讨论】:
-
你尝试了什么?