Class CharacteristicDaoMySqlIntegrationTest

java.lang.Object
ubic.gemma.core.util.test.BaseTest5
ubic.gemma.core.util.test.BaseIntegrationTest5
ubic.gemma.persistence.service.common.description.CharacteristicDaoMySqlIntegrationTest

@Transactional public class CharacteristicDaoMySqlIntegrationTest extends BaseIntegrationTest5
Real-MySQL counterpart of the H2-backed CharacteristicDaoTest, pinning the native-query methods of CharacteristicDaoImpl against the production Spring context (real MySQL gemdtest via BaseIntegrationTest5).

The native queries all project select {C.*} from CHARACTERISTIC as C ... with .addEntity( "C", Characteristic.class ). Because Characteristic uses SINGLE_TABLE inheritance with @DiscriminatorColumn(name = "class"), @DiscriminatorValue("null") on the root, and a Statement subclass, the {C.*} alias expansion has to emit the discriminator class column so Hibernate can choose the right EntityPersister per row. On MySQL this surfaces as

Unable to find column position by name: class [Column 'class' not found.]
which H2 (MODE=MYSQL, the CharacteristicDaoTest backend) does not reproduce because H2 and MySQL diverge on how the {alias.*} discriminator expansion is rendered.

Each test seeds a mix of plain Characteristic rows (null discriminator) and at least one Statement row (non-null discriminator) sharing the same probe URI / value / category, then asserts the DAO call RETURNS (does not throw) and includes the Statement subclass row. findByUri is expected to throw on MySQL today — that's the bug this test pins; do NOT weaken the assertion to dodge it.

Class-level Transactional opens a per-test transaction Spring rolls back at end-of-test, so the seeded rows never pollute the shared gemdtest schema — no manual cleanup needed.

  • Constructor Details

    • CharacteristicDaoMySqlIntegrationTest

      public CharacteristicDaoMySqlIntegrationTest()
  • Method Details

    • setUp

      @BeforeEach public void setUp()
    • testFindByUri_returnsPlainAndStatement

      @Test public void testFindByUri_returnsPlainAndStatement()
    • testFindByValueLike_returnsPlainAndStatement

      @Test public void testFindByValueLike_returnsPlainAndStatement()
    • testFindByCategoryLike_returnsPlainAndStatement

      @Test public void testFindByCategoryLike_returnsPlainAndStatement()
    • testFindByCategoryUri_returnsPlainAndStatement

      @Test public void testFindByCategoryUri_returnsPlainAndStatement()
    • testFindByParentClasses_returnsPlainAndStatement

      @Test public void testFindByParentClasses_returnsPlainAndStatement()
    • testCountExperimentsByUrisAsAnonymous

      @Test public void testCountExperimentsByUrisAsAnonymous()
    • testCountExperimentsByUrisAsLoggedInUser

      @Test public void testCountExperimentsByUrisAsLoggedInUser()
    • testCountExperimentsByUrisAsAdminWithExclusions

      @Test public void testCountExperimentsByUrisAsAdminWithExclusions()