I currently have a one-to-many relation between 2 table: I have:
Table A (id, ...)
Table B (tableAId, ...) (has no id of it's own).
In the mapping this is done using <list>.
The issue I am having, is that I have to add another one to one relationship from A to B. Something like this:
class A {
public B b; // new part
public List<B> bs; // already existing part.
}
I have a boolean column in the table by which I should differentiate between the one-t开发者_运维技巧o-one and one-to-many. I'm not sure how to write the hibernate mapping for these tables. Could any of you help me out with this?
I think you can do this by using 'mappedBy', have you tried that?
http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/#entity-mapping-association
精彩评论