问题标签 [entity-model]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
397 浏览

java - 字段“record_id”没有默认值 - Spring JPA 错误

我正在为已经开发的 Spring Boot Web 应用程序添加一个功能。具有子实体的主要实体是记录。它有一些列/变量,我现在希望它们位于它自己的独立实体 (CustomerOrder) 中,并与记录以一对一的关系存在。总结一下:

记录 {

- 事情 1

- 事情 2

- 事情 3

}

现在变成:

顾客订单 {

- 事情 1

- 事情 2

- 事情 3

}

记录{客户订单}

我对我制作的东西有一些问题。这是 CustomerOrder 模型的相关关系数据:

然后这里是 Record 模型的相关数据:

当我尝试发布记录时,当用户尝试在 ui 中创建记录时,我的问题存在。这是记录的 POST 方法:

我收到的错误如下:

这至少对我来说是有意义的,因为我正在尝试保存依赖于 Record 对象的 CustomerOrder 对象,该对象尚未被持久化。那么,我该如何更改订单和/或创建和保存 Record 对象,以便我可以将 CustomerOrder 对象保存到其中?

另外,我正在使用 mysql,这是我已经拥有的迁移脚本。我必须在这里为 customer_orders 表添加一些东西吗?

这是 Records 表和 CustomerOrders 表的 mysql 脚本:

0 投票
1 回答
129 浏览

events - In Domain Driven Design - single public entity model, or model per bounded context?

In Domain-Driven Design, we try to separate concerns between the functional areas (bounded contexts), and minimize dependencies between the contexts. The same entity can have different internal representation in different contexts. But in the communication between contexts (e.g. exposed APIs and/or events), do we tailor the representation of entities to each data consumer, or rather do we use a common representation?

For example, take the well-known separation (as diagrammed by Martin Fowler) between the Sales and Support contexts. Both contexts need to be aware of Customer and Product. But in Support context, a Customer has a list of Tickets; while in Sales context, a Customer is assigned to a Territory. Quite possibly, the internal representations will be completely different in the two contexts. But for exposed APIs and events, do we have a single Customer model that includes both these features, or do we have multiple models per context.

0 投票
0 回答
21 浏览

asp.net-mvc - 在构建 Docker 文件时尝试处理输入文件“Server Model\Model1.edmx”时出错

我正在尝试构建一个 docker 文件来运行 ASP.net 应用程序。

在此处输入图像描述

我是 Docker 新手,并且已经阅读了一些文档。我正在尝试执行 15 个命令,其中 10 个正在执行。命令

通过抛出以下错误而失败

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.targets(65,5):错误:尝试处理输入文件“服务器模型\Model1.edmx”时出错。

有人可以帮我解决这个错误吗?谢谢你

0 投票
1 回答
29 浏览

database - JPA 映射关系

假设我有 3 个实体:MonitorPeriodMonitorFile

现在要求说对于每个MonitorPeriod,哪个表如下所示:

我有一个而且只有一个Monitor,该表可能如下所示:

现在,每个File,哪个表可能如下所示:

可以有 N Monitor但每个MonitorPeriod只有一个。

有没有办法通过 JPA 模型实现这一目标?实体模型甚至应该创建阻止我在监视器表中插入两个具有相同MonitorPeriod ID 和相同文件ID 的 tupla 的约束。

- - - - - - - - - - - -更新 - - - - - - - - - -

是的,克里斯,你是完全正确的!我对我的功能分析师说过的话是一样的。

目标是在Monitor表中设计这三个实体关系:

我将有一个允许我插入的约束,例如:

我尝试重复这个逻辑:一个MonitorPeriod(从 1 月到 3 月的示例)可以只有一个Monitor(假设该监视器包含文件的详细信息,例如大小和扩展名,就是这样)。这是一个@OneToOne关系。现在的问题是一个文件可以有更多的监视器,但一个周期,如果一个与监视器有关系的连接文件我无法实现上述情况。@OneToMany

也许我应该以不同的方式连接实体或插入另一个表,我会尝试让你知道。同时,如果有人可以建议我一些,我将不胜感激!