You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- I'm a little confused. What does the productID value actually signify here? Are you saying that a single product can have multiple productID values depending on which description is used?Andrew– Andrew2017-04-26 19:13:49 +00:00Commented Apr 26, 2017 at 19:13
- Are the common fields of the product located in Product table? Or It's just a table for relationships? For the second case it',s just unecessary because It looks like a one-to-one relationship. The name also could lead to confusion.Laiv– Laiv2017-04-26 19:27:47 +00:00Commented Apr 26, 2017 at 19:27
- @Andrew, the productId is an auto generated (incrementing) id in the database. It's a surrogate key. A productId should refer to 1 & only 1 real world product. Each data source may have its own data about that product and the DB must capture that. Suppose we have an iron door. If it's the first product inserted into the DB it will be given a productId of 1. Now, data source A may give a description of "fine door". Data source B may give the same iron door a description of "old iron door". So, DataSourceProduct will have 2 rows (1 row for each data source). Both rows will have productId = 1.James– James2017-04-26 19:49:42 +00:00Commented Apr 26, 2017 at 19:49
- 1@James Then I would change the name to the table because It's confusing. It's rather a SKU than a Product. Also many-to-one relationship can be implemented with two tables only. The table Product, IMO, is adding complexity to the model.Laiv– Laiv2017-04-26 19:59:25 +00:00Commented Apr 26, 2017 at 19:59
- 1@James I'm not sure I agree with Laiv about condensing to two tables. It seems that the DataSourceProduct table (which may be misnamed) embodies the relationship between the dataSource and the Product. I assume the product table contains many other details about the product, other than the DataSource-associated name? Anyway I would probably create objects for each of these tables and define the relationships between them using JPA notation. I don't see much inheritance since they each contain their own relevant fields -- which is probably why you should rename.Andrew– Andrew2017-04-26 20:59:12 +00:00Commented Apr 26, 2017 at 20:59
| Show 8 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-java