3 Replies Latest reply on Oct 10, 2007 9:17 AM by Pete Muir

    Weird entity behavior

    Stuart Douglas Master

      I have some entities, call them Portfolio and Account

      Account is the root of a single table inheritance heirachy.

      Portfolio has a OneToMany bidirectional relationship to a Account, mapped using a foreign key in Account.

      if i call portfolio.getAccounts() the accounts do not get initialized properly. All the primitive properties of Account are initialized but not relationships to entities that have already been loaded (or something like this, I am not 100% sure).

      So if I take one of the Account's that I got using portfolio.getAccounts() and call account.getPortfolio() it will return null. Same with other entities that are loaded (e.g. Acccount has a List of AccountTransactions, I can call account.getAccountTransactions() no problems but not accountTransaction.getAccount()).

      Does anyone know what could be causing this? There is nothing special about the entities and apart from this one problem everything else works fine.