0 Replies Latest reply on Mar 8, 2006 8:36 AM by tcom tcom

    Problem updating EJB3 Beta to RC5

    tcom tcom Newbie

      Hi,

      I'm actually using the EJB 3 Beta with Jboss 4.0.3RC1 and I tried to use EJB3 RC5 with JBoss 4.0.3SP1 but there is a problem with the One 2 Many annotation when using for a unidrectionnal relation.

      I have the following code for my Entity Bean "BeanService":

      public class BeanService implements Service, Serializable {
      ...
      private Collection<BeanQuestionnaire> questionnaires;
      
       public void addQuestionnaire(BeanQuestionnaire questionnaires){
       this.questionnaires.add(questionnaires);
       }
      @OneToMany
       public Collection<BeanQuestionnaire> getQuestionnaires() {
       return questionnaires;
       }
       public void setQuestionnaires(Collection<BeanQuestionnaire> questionnaires) {
       this.questionnaires = questionnaires;
       }
      ...
      }
      


      And this one for my Session Bean :

      newQuest = new BeanQuestionnaire();
      
      service = (BeanService) manager.find(BeanService.class, idService);
      
      service.addQuestionnaire(newQuest );
      
      manager.persist(newQuest );
      manager.persist(service);
      
      


      With the Beta version, it's working find.
      With the RC5, the new BeanQuestionnaire is saved to the database but not the relation between BeanService and BeanQuestionnaire. So,When I am using the getQuestionnaires() methode, the collection returned is empty.

      What I have to change to fix that?

      Thanks

      Mark