Hope I have the right forum... I'm looking to define a 1 to 0..1 relationship in CMR using XDoclet and deploying to JBoss. The relationship of the bean is a relationship to itself represented in a table like this:
Where parent_id refers to another customer (imagine it as the holding company of a customer - which is a customer as well...). I'd need getParent() and getChild() methods (bidirectional) as well as the associated setters. Again, this is using XDoclet... Any tips?
First, I'd make sure that a 1:0..1 is what you really want. You used a holding company as an example, but can't one holding company hold multiple companies? Also, your customer table could allow a 1:N relationship. Otherwise, XDoclet will do this fine. I don't have time to test it, but here's a start.