Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: XML-Mapping to list without index column, or some other workaraound ...

 
Erich Tiegelholz
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone. I'm quite new to Hibernate and need help in a hopefully simple task.

I do have: An XML mapping of table A to class A.java.

I do have: Another table B that has a common column with A (its value is key in A, but can occur more than once in B), and 2 other columns that I do need in the mapping to class A.

I can map a column region to a Set like this in the XML mapping of table A:


... and do the same for the other column.

But, this does not help me since the order of a Set can be random, and if I get 2 Sets I can't know which values read from B's 2 other columns were in the same row. I do however need this information.

I too can't use mappings to List since B has no index column. (Or is there some way to auto-simulate the existence of one?)

Does anyone know how I can work around my problem? What in need in my Java is the result of


Thanks in advance and kind regards

Eques T.
 
Erich Tiegelholz
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use a <composite-element>, and if yes, how?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic