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.
- 2This is a good idea but for smaller projects it really starts to feel like overkill. This approach also requires a translation layer between the ORM persistence layer and the domain model.maple_shaft– maple_shaft ♦2012-03-21 11:39:23 +00:00Commented Mar 21, 2012 at 11:39
- @maple_shaft agreed, and that's what I meant by "mapping" :-)ozz– ozz2012-03-21 11:42:26 +00:00Commented Mar 21, 2012 at 11:42
- @Ozz, the way I've worked is exactly that, the entity classes ARE the domain model (and I might add with quite lots of success). I agree that it ties the domain model to the schema, but that's exactly what I want, as I use convention over configuration, and the nice side effect is that if I see a field on an entity, I don't need to think hard about the name of the table and column where that information is stored.Augusto– Augusto2012-03-21 11:54:22 +00:00Commented Mar 21, 2012 at 11:54
- @Augusto I've done it too! and as maple_shaft says, it's fine for small CRUD style apps, but there are many issues as the OP is finding out. One example might be where you have a many to many mapping table eg: StudentClasses, that maps Students to their classes and just contains StudentID and classID, you would not necessarily want to map this in your domain. That's just a quick off the top of my head example.ozz– ozz2012-03-21 12:07:17 +00:00Commented Mar 21, 2012 at 12:07
- 3@Ozz: Your comment seems to contradict the very idea of an ORM. An ORM doesn't "tie your domain directly to your DB schema". The ORM maps your domain to a DB schema, without the need for a separate DAO layer. That's the whole point of an ORM. And most ORMs handle many-to-many mappings just fine, with no domain model needed for the mapping table.kevin cline– kevin cline2012-03-21 16:54:24 +00:00Commented Mar 21, 2012 at 16:54
| Show 3 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