Nils
I haven't got all the details straight, but this looks to me like a
caching problem. The only way I can think of that updates can get
"undone" in the way you describe is if more than one instance of the
entity is being held in jBoss.
Marc - any thoughts? (In another post, Nils says he is using up to date
code from CVS)
Justin
Nils Hartmann <[EMAIL PROTECTED]> wrote:
>I have a very similiar behaviour that Charles reported:
>I create an entity bean with some initial values (set in ejbCreate()).
>Looking in the database everything looks fine. Then I update an
>attribute of my bean (setAttribute()). Calling getAttribute() shows,
>that the attribute is probably set right.
>Then I do a findByAttribute with the new value, and - correctly - one
>RemoteInterface to my entity bean is returned... BUT: calling on this
>remote interface getAttribute() again, it returnes the old value... The
>remote interface I've had *before* executing the find method still
>returns the new value:
>
>some dummy code for example:
>
>MyBean bean = MyBeanHome.create("aValue"); // sets attribute to aValue
>-> correct
>bean.getAttribute() // returns - correct - "aValue"
>bean.setAttribute("anotherValue"); // hmmm...
>bean.getAttribute(); // -- returns: "anotherValue"
>MyBean bean2 = MyBeanHome.findByAttribute("anotherValue"); // returns -
>correct - remote interface
>bean.getAttribute(); // -- returns - correct - anotherValue
>bean2.getAttribute(); // -- returns - FALSE - aValue
>
>In the serverlog there is an UPDATE command executed with correct value
>"anotherValue" after executing setAttribute. Unfortunatly the following
>both calls to getAttribute are not logged.
>When my Client stops at this point, the changes are correct in the
>database, but when it does a further call to a third method, another
>UPDATE command is executed, with the OLD value :-(:
>
>bean.domeSomethingElse(); // ---> causes an UPDATE bean with old
>("aValue")
>
>I tried to get the bug, but I think I haven't understand enough how the
>container works yet. Hopefully that will be better some day, at least if
>there are a lot more bugs ;-). I'm not sure, where the bean itself is
>loaded from the database ?!
>
>regards! nils
>
>
>>
>> In message <[EMAIL PROTECTED]>, Charles Crain
>> <[EMAIL PROTECTED]> writes
>> >I have been experimenting with container-managed persistence in JBoss.
>> >What I cannot figure out is what triggers the server to save the
>> >currently loaded entity beans to the database. I've tried running the
>> >CD example, as well as a test bean I wrote myself. When you create the
>> >bean, JBoss creates a database entry with the primary key populated, and
>> >all other fields blank. When you start setting properties of the Bean,
>> >they are not updated in the database. If you stop the server (or the
>> >machine crashes, etc.) the database stays that way -- primary keys but
>> >no data.
>> >
>> >I figured a graceful shutdown of the server would at least flush the
>> >data to the database, but this does not appear to be the case.
>> >Furthermore, if the server were to crash, lose power, etc., all new data
>> >would be lost.
>> >
>> >Does anyone know a way to change this?
>> >
>> >-Charles
>> >
>> >
>> >
>> >
>> >--
>> >--------------------------------------------------------------
>> >To subscribe: [EMAIL PROTECTED]
>> >To unsubscribe: [EMAIL PROTECTED]
>> >Problems?: [EMAIL PROTECTED]
>> >
>>
>> --
>> Justin Forder
>>
>> --
>> --------------------------------------------------------------
>> To subscribe: [EMAIL PROTECTED]
>> To unsubscribe: [EMAIL PROTECTED]
>> Problems?: [EMAIL PROTECTED]
>
--
Justin Forder
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]