0 Replies Latest reply on Jun 1, 2004 11:13 AM by Pablo Bendersky

    XDoclet, value-object and not-null FK

    Pablo Bendersky Newbie

      I'm using XDoclet to generate my value objects, and I'm having trouble with the compose tags.
      The scenario is as follows: I have a Country entity bean, and a State entity bean. A Country can have many states.
      In the DB, I have a foreign key on the states table, and the foreign key is setted up as not-null (required by the DB team).
      On the Country class, I'm using tags such as:
      compose = "test.ejb.StateValue"
      compose-name = "StateValue"

      When I generate the CMP classes, I get a bunch of methods, such as addState(StateValue v).
      I would really like to use the addState method, however that method creates a state, and only after it, it adds it to the states collection on my country bean. This causes the not-null FK to throw an exception.

      Is there any workaround for this?
      I'd really like to keep using the generated code from XDoclet, and I cannot give up on the not-null FK for now.

      Thanks in advance!