0 Replies Latest reply on Oct 30, 2007 4:34 AM by statelessbean

    Strange behaviour wit 1:n collection with EJB 3.0 and Tomcat

    statelessbean

      Hi,
      Can anyone explain me what is going one?
      I got collection mapped (one directional) from planet->buildingsProd class like this

      @OrderBy("index ASC")
      @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
      @JoinColumn(name="Planet_idPlanet")
      public List<BuildingsProd> getBuildingsProdList() {
       if (buildingsProdList == null)
       buildingsProdList = new LinkedList<BuildingsProd>();
       return buildingsProdList;


      and when I load my planet
      Planet planet = em.find(Planet.class, idPlanet);


      and add new object to collection

      BuildingsProd b = new BuildingsProd();
      planet.getBuildingsProdList().add(b);
      em.merge(planet);


      new object should me inserted into db with my planet key and here is my question.
      This works fine on JBoss 4.0.5 but on tomcat with jboss embedded new object is inserted into db but withoud planet FK key!!!
      Why, and what is wrong here?

      I got also installed JBoss embedded for my tomcat and seam 2.0.0 CR 2 app.