[jboss-user] [EJB 3.0] - Strange behaviour wit 1:n collection with EJB 3.0 and Tomcat
Stateless Bean
do-not-reply at jboss.com
Tue Oct 30 04:32:57 EDT 2007
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?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100099#4100099
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100099
More information about the jboss-user
mailing list