Re: [JBoss-user] Manual database update lost
Seems like you're fighting the system a bit. My understanding may be incorrect but with CMP, you're telling the system that whatever you have in your EJBs needs to be persisted somehow. When it sees the DB out of sync with the bean, it updates the DB. That's my guess but I'm sure the EJB luminaries will give you more info. Isn't there a flag to tell Jboss that the datasource is shared (i.e. may be updated externally)? Hunter From: "D I Macdonald" [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Wed, 18 Apr 2001 16:49:14 +0100 To: [EMAIL PROTECTED] Subject: [JBoss-user] Manual database update lost Hi there - I have only recently started coding EJBs and have come across the following problem: I have an entity bean, Customer, which has been set to use CMP based on an existing table structure (using jaws.xml and an Oracle DS). Everything works fine - my client app can retrieve and set data exactly as it should. If I run my client and list all the customers (with a certain findBy criteria), I get FIRSTNAME SURNAMEIDENTIFIER ADDRESS --- --- -- - Jack Vinegar61 The Hill Jill Vinegar62 The Hill (All this does is use a findByX method - no writes to the db are performed.) I then, via sqlplus, change Jill's surname to be "Brown", commit the change, and do a select statement to confirm that it has actually changed. Finally, I run the client again only to see the same result as that given above. I thought it might simply be a caching issue, but sqlplus shows the data in the DB has actually been altered. So my questions are: a) Is it permissable to have more than one agent altering a table which a CMP Bean uses to store its persistent state ? b) If it is, how can I prevent the bean changing data in the DB (except where a set method is deliberately called) ? I see there is a "read-only" tag that can be set, but ideally I would like to have my bean write data as well (when I *ask* it to). Regards D I Macdonald ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Manual database update lost
The behavior you observe is because JBoss defaults to 'Commit option A' (see the EJB 1.1 spec for a detailed discussion of this). If you have external (to JBoss) updaters of your database, change your commit-option to B or C in jboss.xml (or standardjboss.xml to change it globally). -danch D I Macdonald wrote: Hi there - I have only recently started coding EJBs and have come across the following problem: I have an entity bean, Customer, which has been set to use CMP based on an existing table structure (using jaws.xml and an Oracle DS). Everything works fine - my client app can retrieve and set data exactly as it should. If I run my client and list all the customers (with a certain findBy criteria), I get FIRSTNAME SURNAMEIDENTIFIER ADDRESS --- --- -- - Jack Vinegar61 The Hill Jill Vinegar62 The Hill (All this does is use a findByX method - no writes to the db are performed.) I then, via sqlplus, change Jill's surname to be "Brown", commit the change, and do a select statement to confirm that it has actually changed. Finally, I run the client again only to see the same result as that given above. I thought it might simply be a caching issue, but sqlplus shows the data in the DB has actually been altered. So my questions are: a) Is it permissable to have more than one agent altering a table which a CMP Bean uses to store its persistent state ? b) If it is, how can I prevent the bean changing data in the DB (except where a set method is deliberately called) ? I see there is a "read-only" tag that can be set, but ideally I would like to have my bean write data as well (when I *ask* it to). Regards D I Macdonald ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user Confidential e-mail for addressee only. Access to this e-mail by anyone else is unauthorized. If you have received this message in error, please notify the sender immediately by reply e-mail and destroy the original communication. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
SV: [JBoss-user] Manual database update lost
Hi, This must be the no. 1 question on the list! :-) jBoss defaults to commit-option A in standardjboss.xml. Basically this means that jBoss is supposed to be the only one fooling around with the datasource. Look in the spec to determine if commit-option B or C is your preferred choise... ^terp -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Pa vegne af Hunter Hillegas Sendt: 18. april 2001 18:10 Til: JBoss 2 Emne: Re: [JBoss-user] Manual database update lost Seems like you're fighting the system a bit. My understanding may be incorrect but with CMP, you're telling the system that whatever you have in your EJBs needs to be persisted somehow. When it sees the DB out of sync with the bean, it updates the DB. That's my guess but I'm sure the EJB luminaries will give you more info. Isn't there a flag to tell Jboss that the datasource is shared (i.e. may be updated externally)? Hunter From: "D I Macdonald" [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Wed, 18 Apr 2001 16:49:14 +0100 To: [EMAIL PROTECTED] Subject: [JBoss-user] Manual database update lost Hi there - I have only recently started coding EJBs and have come across the following problem: I have an entity bean, Customer, which has been set to use CMP based on an existing table structure (using jaws.xml and an Oracle DS). Everything works fine - my client app can retrieve and set data exactly as it should. If I run my client and list all the customers (with a certain findBy criteria), I get FIRSTNAME SURNAMEIDENTIFIER ADDRESS --- --- -- - Jack Vinegar61 The Hill Jill Vinegar62 The Hill (All this does is use a findByX method - no writes to the db are performed.) I then, via sqlplus, change Jill's surname to be "Brown", commit the change, and do a select statement to confirm that it has actually changed. Finally, I run the client again only to see the same result as that given above. I thought it might simply be a caching issue, but sqlplus shows the data in the DB has actually been altered. So my questions are: a) Is it permissable to have more than one agent altering a table which a CMP Bean uses to store its persistent state ? b) If it is, how can I prevent the bean changing data in the DB (except where a set method is deliberately called) ? I see there is a "read-only" tag that can be set, but ideally I would like to have my bean write data as well (when I *ask* it to). Regards D I Macdonald ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user