Hi Jon/all,
I attached a jar with the test case. Basically, there are 5 source files in
here and a sql script to create the entities.
The interface for the stateless session bean, the concrete class for it.
The 2 Entites, and the Test case. Its pretty small.
If you take a look at the test case, if it passes, that in itself displays
the problem. The test case is TestAudioServices, and the line that
**should** fail is line 40, it looks for null for the name of the status
(which should never be null). The proof that this case displays the
problem, is on line 43, basically line 42 reloads the entity by its id, and
then checks to see if the status now is not null, one of those 2 lines (41
or 43) should fail.
These are the lines in question:
file = stateless.update(file);
assertNull(file.getAudioFileStatus().getName());
file = stateless.findById(file.getId());
assertNotNull(file.getAudioFileStatus().getName());
Thanks for looking into this, I keep thinking I'm going to find something
wrong in my code, but I'm not seeing it so far, and its relatively trivial
now.
http://www.nabble.com/file/p22509703/testerror.jar testerror.jar
-chris
Jonathan Gallimore-2 wrote:
>
> Nothing obvious immediately springs to my mind as to why this might
> happen. Would you be able to provide us with a test case that produces
> this problem so we could troubleshoot it?
>
> Regards
>
> Jon
>
>
> coloradoflyer wrote:
>> Hi all,
>>
>> I wrote a small app to look at openejb and am having an issue with one of
>> the relationships.
>>
>> Before posting too much code I wanted to see if anything is obviously
>> wrong.
>> The application has about 5 tables, I'm creating one row and building a
>> OneToMany association to another pre-existing entity, this all works
>> without
>> issue. The next step in my test case was to update the OneToMany to
>> another
>> pre-existing entity. All of the fields are already populated and I'm
>> invoking the setter on the entity. Once this is done, I invoked the
>> merge
>> method on the Injected entityManager. The object returned from this is
>> in
>> tact, and has the association, but one of the fields in the associated
>> object is set to null.
>>
>> I'm working in OpenJPA 1.1, OpenEJB3.1, database is Postgres.
>> The code is inside a local Stateless session bean method.
>>
>> The foreign key association for the onetomany is updated, and if I invoke
>> the finder to reload the object, it all loads properly, and the null
>> field
>> is populated properly.
>>
>> finally, in order to ensure this was an openejb problem and not something
>> specific to openjpa, I broke the code out of the stateless session, and
>> ran
>> the same code with the transaction management in place without openejb.
>> Basically, the entity ended up with the proper field value after the
>> merge.
>>
>> thanks for any info/help.
>>
>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/openejb3.1-merge-tp22469332p22509703.html
Sent from the OpenEJB User mailing list archive at Nabble.com.