Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [EJB 3.0] - Entitymanager Persistent

scott.stark@jboss.org

2007-05-03


Hi,

i have 2 entity bean, Rollingstock and Schedule.
Hear is some code:


| rollingstock = new Rollingstock();
| rollingstock.setNextRoute( "STH" );
| rollingstock.setRoute( "HALL" );
| schedule = new Schedule();
| rollingstock.setSchedule( schedule );
|

So now i whant to persist the entitys, i thought that i just neded to do:
manager.persist(rollingstock);
then bouth rollingstock and schedule would be persist, but i get a exception when i do that.
i must do this to get both persist:

| manager.persist(rollingstock);
| manager.persist(schedule);
|

is thair any better way to persist entitys, Because in my Rollingstock entity i have a lot off relations, so when i get a Rollingstock i just whant to run persist(rollingstocko);
now i must take out evrything and do persist on each entity.

any clarification ?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042833#4042833

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042833
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.