Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] rewriting updateall queries clean-up code intests

Hi Andrei,

Alternative solution would be to implement initialize method on the
platform and change all the forbidden names to smth else:

Thanks for coming up with things to try.

Unfortunately, this one did not work.

I got a NPE in this.getSequences().values(); apparently the sequences haven't been set up yet at the time of this method's first call.

So I added a null-check (in case the sequences would be added later and initialize() would be called again), but "SEQUENCE" is still being used as sequence table name, causing tests to fail.

Is there another way to make this work?

That said, in a number of cases where I made changes the table
generator was defined but because of a typo in the @GeneratedValue's
values it wasn't matched to it so the default generator was used
instead. It should be okay to fix them to let such tests run the way
they were originally intended, shouldn't it?

Which particular cases you are talking about here?


- jpa/eclipselink.jpa.test/resource/eclipselink-xml-only-model/inherited-entity-mappings.xml
(XML_BECKS_TAG_TABLE_GENERATOR generator is defined,
BECKS_TAG_TABLE_GENERATOR is what is looked for)

- jpa/eclipselink.jpa.test/resource/eclipselink-xml-only-model/relationships-entity-mappings.xml
(XML_ORDER_CARD_TABLE_GENERATOR generator is defined,
 XML_ORDER_LABEL_TABLE_GENERATOR is what is looked for)

- jpa/eclipselink.jpa.test/resource/eclipselinkorm/eclipselink-xml-extended-model/complexaggregate-extended-entity-mappings.xml
 OWNERSHIP_GOUP_TABLE_GENERATOR is what is looked for)

- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/complexaggregate/
(ROLE_TABLE_GENERATOR generator is defined,
 ROLL_TABLE_GENERATOR is what is looked for)

- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/xml/merge/inherited/ (CERTIFICATION_TABLE_GENERATOR generator is defined in another persistence context, the generator defined in this context is

- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inheritance/ (CMP3_AAA_GENERATOR generator is referred to but not defined anywhere.. There is no comment in the code that indicates this is on purpose.)

The following may or may not be important for the test:

- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/ (USED_TO_TEST_A_LOG_MESSAGE generator (which has no 'table' attribute) is defined but not referred to from anywhere).

The last one, which I didn't include in my patch because even after fixing it the test still fails, is the following:

- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/ddlgeneration/tableperclass/
(keyGen generator is defined,
 key-gen is what that entity and others in this package are looking for)


----- Original Message ----- From: "Dies Koper" <diesk@xxxxxxxxxxxxxxxxxxx>
To: "Dev mailing list for Eclipse Persistence Services"
Sent: Tuesday, January 12, 2010 12:51 AM
Subject: Re: [eclipselink-dev] rewriting updateall queries clean-up code

Hi Andrei, Tom,

Thanks to both of you for looking at my patch. Much appreciated!

In general, I agree with Andrei that we shouldn't stop testing table
sequences with the name SEQUENCE for all platforms - it has been our
default for a long time so most users will have it. The issue here will
be making changes that fit into our test framework.

In talking with Andrei, I think a better solution may be to implement a
customizer that loops through the sequences in a project and changes any
table sequence with the name "SEQUENCE" to something else. That
customizer could be enabled with a System property when running the
tests on Symfoware.

One issue with what I've done currently is that as soon as someone
adds a new test with for example a <generated-value/> tag it will fail
again on Symfoware until I give it another table name explicitly. It
sounds like your solution is more practical.

Do you have a sample customizer I can look at and the way to register
it at the start of the tests? Or are you looking at writing one for
me? (not sure how much work is involved)

That said, in a number of cases where I made changes the table
generator was defined but because of a typo in the @GeneratedValue's
values it wasn't matched to it so the default generator was used
instead. It should be okay to fix them to let such tests run the way
they were originally intended, shouldn't it?

2. UpdateAll/DeleteAll
I also noticed such queries in some other tests and wasn't sure
whether/how to fix them. What do you think?


The tests here don't seem to use UpdateAll/DeleteAll queries but the
clear method does. It uses UnitOfWork instead of EntityManager. Where
can I find the UnitOfWork API equivalent to doing a find and removing
each object in the resultset?

I am a hesitant to change this test for all platforms, but you could add
an isSymfoware() check and then do some alternate clean up. Which
queries fail? (I assume just the ones that deal with Employee)

Yes, you are correct, just the UpdateAllQuery and DeleteAllQuery with
With the alternate clean up all tests in these suites now pass. Thanks!


- testTwoUnrelatedResultWithOneToManyJoins
- testMultipleUnrelatedResultWithOneToManyJoins
- testTwoUnrelatedResultWithOneToOneJoins
- testTwoUnrelatedResultWithOneToOneJoinsWithExtraItem

The clear should be able to be fixed in much the same way as above.

I agree those test should be excluded for symfoware.


The patch also includes a number of other issues I addressed. Could
review them?

When we have come up with a good solution for the issue with SEQUENCE,
I'll go through the whole patch and either integrate it (with any small
changes needed) or provide feedback about bigger changes.

The customizer solution sounds good to me. The one Andrei suggested
should work too, I suppose. With either I need a few more details to
get me on my way. For the customizer I listed my questions above. For
Andrei's way, where do I define these sequence generators? How can I
enable/disable them with the isSymfoware flag (or system property)?
I tried adding them using annotations to one of the entity classes,
which I believe worked, but that works only for the persistence
context that loads that class.


Back to the top