Skip to main content

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.

3
  • 1
    Your question is somewhat unclear. What do you mean by "translating"? Do you mean how to design objects that encapsulate and represent the data queried from the database? Commented Dec 5, 2011 at 1:02
  • Yes for instance. If I have one survey with many comments. How would I model that in Java or if I have many recipes that have many tags (many-to-many). Commented Dec 5, 2011 at 1:07
  • @Robert, you do not want to map everything. You want to have "getters" and "setters" stored procedures and maybe map their input and output instead of mapping every table to some object. Modern DBMS are amazing at doing things fast and correct. Why not leverage it? In your case, have a proc that returns everything you need from the comment table given the survey id. Then manually store those comments in a collection. I have done somethign like that in C#. I would have a CommentEntry class with members mirroring columns wo code generation. foreach(row in res) { lst.add(new CommentEntry(row))} Commented Dec 5, 2011 at 3:41