java 在 Hybris 电子商务上创建产品数据模型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13304854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 12:12:55  来源:igfitidea点击:

Creating product data model on Hybris e-commerce

javae-commercedata-modelingdatamodelhybris

提问by user594883

I'm evaluating different e-commerce platforms. As part of this work I'm evaluating how our present product structure fits the platforms. With vendors such as IBM it's easy since they have all the material publicly on web. I have growing interest on Hybris e-commerce. However they have no material what so ever available. They have a private wiki that I have access to but even there is no material on their data model.

我正在评估不同的电子商务平台。作为这项工作的一部分,我正在评估我们目前的产品结构如何适应平台。对于像 IBM 这样的供应商来说,这很容易,因为他们在网络上公开了所有材料。我对 Hybris 电子商务越来越感兴趣。然而,他们没有任何可用的材料。他们有一个我可以访问的私人维基,但即使他们的数据模型也没有资料。

Hybris' reps keep on insisting that their product is so flexible that any data model can be created. Well I believe them but there are still boundaries that should not be crossed, e.g. GUIs and reports display certain pieces of data and OOB order management for sure relies on certain data. To make the full use of OOB features, the data model I create must follow that of Hybris'. However Hybris doesn't allow me to see their data model, so I'm in a chicken and egg-kind of situation.

Hybris 的代表一直坚持认为他们的产品非常灵活,可以创建任何数据模型。好吧,我相信他们,但仍然存在不应跨越的界限,例如 GUI 和报告显示某些数据,而 OOB 订单管理肯定依赖于某些数据。为了充分利用OOB的特性,我创建的数据模型必须遵循Hybris的模型。然而,Hybris 不允许我查看他们的数据模型,所以我处于一种先有鸡还是先有蛋的情况。

Now my question is: Do you have experience on modeling product structure on Hybris and how have you approached this? All help appreciated!1!

现在我的问题是:您是否有在 Hybris 上对产品结构进行建模的经验?您是如何处理这个问题的?感谢所有帮助!1!

Cheers!

干杯!

回答by TheOutSideBox

Hybris data model or to say the TYPE SYSTEM is very flexible. I have been working on Hybris for last 4 yrs and never came across a situation where it will fail as long as modeling is concerned. Type System is Hybris ORM, where all of the Java Objects are defined in XML format and at the same time mapped to Data base tables and columns. All of the java data types are supported, types collections are supported as well. Type System is independent of choice of DB and all most no change (or very minimal extra configuration) to items.xml even on DB change. Exception will be CLOB which will require DB vendor specific or equivalent DB column data type configuration, again in the same items.xml.

Hybris 数据模型或者说TYPE SYSTEM 是非常灵活的。过去 4 年我一直在研究 Hybris,从来没有遇到过只要建模就会失败的情况。类型系统是 Hybris ORM,其中所有 Java 对象都以 XML 格式定义,同时映射到数据库表和列。支持所有 java 数据类型,也支持类型集合。类型系统与 DB 的选择无关,并且即使在 DB 更改时,items.xml 也几乎没有任何更改(或非常少的额外配置)。CLOB 例外,它需要数据库供应商特定的或等效的数据库列数据类型配置,同样在同一个 items.xml 中。

Modeling associations is simple as well in terms of Hybris relations

在 Hybris 关系方面建模关联也很简单

  1. 1:1 -> Modeled as Object2 as attribute to Object1
  2. 1:n or n:1 -> Modeled by Relation item with Source and Target attributes
  3. n:m -> Modeled by Relation item with Source and Target attributes and under separate DB table
  1. 1:1 -> 建模为 Object2 作为 Object1 的属性
  2. 1:n 或 n:1 -> 由具有源和目标属性的关系项建模
  3. n:m -> 由具有源和目标属性的关系项建模,并在单独的数据库表下

Now coming back to Products, Product has two hierarchy which may dwell into multi level structure. The 2 base hierarchy constructs are Product & Product Variants.

现在回到产品,产品有两个层次结构,可以包含在多层次结构中。2 个基本层次结构是产品和产品变体。

Lets model the products for apparels, there may be 4 kind of products:

让我们为服装产品建模,可能有 4 种产品:

  1. Product itself is SKU: BaseProduct
  2. Product has Color variant: BaseProduct -> ColorVariant
  3. Product has Size variant: BaseProduct -> SizeVariant
  4. Product has Color and Size variants: BaseProduct -> ColorVariant -> SizeVariant
  1. 产品本身是 SKU:BaseProduct
  2. 产品具有颜色变体:BaseProduct -> ColorVariant
  3. 产品具有尺寸变体:BaseProduct -> SizeVariant
  4. 产品具有颜色和尺寸变体:BaseProduct -> ColorVariant -> SizeVariant

All of the product properties will be held BaseProduct and Variants will hold only the varying attributes like Color, Size and Cost.

所有产品属性都将保存在 BaseProduct 中,而 Variants 将仅保存不同的属性,如颜色、尺寸和成本。

Extrapolate the type of variants against the product, the Product-Variant hierarchy path will grow, simple with minimum or no-duplication.

根据产品推断变体的类型,产品变体层次结构路径将增长,简单且重复最少或无重复。

For modeling BaseProduct, the only attribute which is mandatory is product code and rest are there but optional, so convenient. This helps in running the enrichment process via workflows and helps in a very flexible base implementation with scope of additions to specific requirements.

对于建模 BaseProduct,唯一必须的属性是产品代码,其余属性是可选的,非常方便。这有助于通过工作流运行扩充过程,并有助于非常灵活的基本实现,并为特定要求添加范围。

Out of the box support for GUI via Service layer services and accelerator is commendable, even with the additions of loads of custom attributes, same will suffice as it is driven from the ITEM to MODEL then DATA conversion. Implementation has full control on Data and segment of data to be populated from Model to Data.

通过服务层服务和加速器对 GUI 的开箱即用支持是值得称赞的,即使添加了自定义属性的负载,同样也足够了,因为它从 ITEM 驱动到 MODEL,然后是数据转换。实现可以完全控制要从模型填充到数据的数据和数据段。

Reports are driven from Report cockpit based on the Jasper reports. Flexible search query is defined with JOINS and UNIONS and even option to execute small java code for a report attribute value population.

报告由基于 Jasper 报告的报告驾驶舱驱动。使用 JOINS 和 UNIONS 定义了灵活的搜索查询,甚至可以选择为报表属性值填充执行小型 Java 代码。

Modeling, Conversion, GUI and Reports, in my opinion is all very well covered by Hybris.

在我看来,建模、转换、GUI 和报告都被 Hybris 很好地涵盖了。

回答by kabadisha

Hybris comes out of the box with a base data model for each extension you choose to enable. This data model has all the things you might expect for an E-Commerce platform, products, categories, classifications etc.

Hybris 开箱即用,为您选择启用的每个扩展提供基本数据模型。该数据模型包含您对电子商务平台、产品、类别、分类等可能期望的所有内容。

Typically one would not expect to remove anything from this data model, but rather only extend it with new types and attributes specific to your application. Any out of the box items or attributes you do not wish to use you can simply not populate them.

通常,人们不会期望从该数据模型中删除任何内容,而只会使用特定于您的应用程序的新类型和属性对其进行扩展。您不想使用的任何现成项目或属性都可以不填充它们。

My suggestion would be to download and install the latest version of Hybris from the wiki and fire it up (I recommend using a local MySQL DB as the default HSQLDB can be a bit slow). The setup is easy - you should be able to find a guide on the Hybris wiki (look at the developer trail).

我的建议是从 wiki 下载并安装最新版本的 Hybris 并启动它(我建议使用本地 MySQL 数据库,因为默认的 HSQLDB 可能会有点慢)。设置很简单 - 您应该能够在 Hybris wiki 上找到指南(查看开发人员跟踪)。

Once you have done this, have a look at the various cockpits to see how the demo storefronts are set up. The HMC (http://localhost:9001/hmc/hybris) should give you a good impression of the data model as it's organisation is tied quite closely to the data model underneath.

完成此操作后,查看各种驾驶舱以了解演示店面的设置方式。HMC ( http://localhost:9001/hmc/hybris) 应该让您对数据模型有一个很好的印象,因为它的组织与下面的数据模型密切相关。

I advise that you try to make use of the standard Hybris types where possible as it will allow you to make use of the standard cockpits which provide the various business user interfaces.

我建议您尽可能使用标准的 Hybris 类型,因为它允许您使用提供各种业务用户界面的标准驾驶舱。