jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes Changes in Entity Bean are not saved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Changes in Entity Bean are not saved" Watch "Changes in Entity Bean are not saved" New topic

Changes in Entity Bean are not saved

Lena Solomonik

Joined: Aug 17, 2001
Posts: 5
Hello, everyone!
Here is my problem.
I have a table. When I change data in the table, a method of the session bean is called, which in turn calls 'set' methods of entity bean. When I call 'get' method after that, it displays a new data. But changes are not saved in the table. It means that they are not saved in database.
Has anyone had this promlem before?
My code looks as follows:
Travelcondition tc = travelconditionHomeRef.findByPrimaryKey(data.id);

switch(col) {
case 0:
log("Succeeded: set_tc(case 0): new value: " + tc.getDisplayOnReport());
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
data.update = (Boolean)value;
System.out.println("Invalid value entered");
}//end of switch
Thanks a lot.
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236

Hi Lena,
Have you written the update statement in the
ejbStore() method? If you have check, the code properly
'coz this method is called when latest values has to be updated
in the data base.
Hope this helps,

Joined: Aug 18, 2001
Posts: 2
Hi Lena, Looks like you are using CMP Type of Entity Bean
I dont see any problem in you assigning the values to the class variables of the bean reference.
The only thing which worries me is that control going inside the switch statement.
If your business doesnt require setting up of each fields..you can as well take the whole object inside the entity bean with a single set method and then assign the values inside the entity bean. i know since you are accssing from local session bean and you r not going to have any remote calls..but in case if in future they try to move to a clustered environment then it might have some issues..this is only a recommendation from my end...
to answer your problems...it shd update your field and if you had specified and mapped all the fields in the rdbms.jar xml file
I agree. Here's the link: http://aspose.com/file-tools
subject: Changes in Entity Bean are not saved
It's not a secret anymore!