Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
需求:需求是拉取(execute())一组数据源。拉动是有序的,可以分组为小的子组。
设计:每个拉动都被抽象为一个步骤。子组被表示为 WaterFallStep,因为组中每个数据源的拉取都是有条件的,并且遵循瀑布模型,即如果组中的第一个数据源拉取成功,那么我会脱离组。
问题
谢谢你。
我认为您应该在这里使用复合模式。我想说每个步骤都应该处理对一组步骤的引用。如果您愿意,您可以将此集合移动到您的 WaterfallStep,但它仍然应该是 Steps 的集合,而不是 BasicSteps 和 AbstractSteps。
关于 JPA,您应该使用 OneToMany 注释。这个注解的用法有很多例子。
祝你好运