Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Integration test causing a duplicate entry exception on insert

  1. #21
    Join Date
    Mar 2008
    Posts
    253

    Default

    So I posted on the Hibernate Forum, this time using the HSQLDB file type instead of mem as it shows more in the log.

    https://forum.hibernate.org/viewtopic.php?f=1&t=1015149

    I still wonder if the Spring Roo setup of

    <property name="hibernate.hbm2ddl.auto" value="create"/>

    in the persistence.xml file is really being used as the HSQLDB log shows all these drop if exists statements.
    Last edited by stephaneeybert; Apr 14th, 2012 at 03:08 AM.
    Stephane

  2. #22
    Join Date
    Mar 2008
    Posts
    253

    Default

    I wonder why wanting to try running the integration test in HSQLDB instead of MySql.

    Would that give more information on the cause of the original unique attribute not being seen by Roo ?
    Stephane

  3. #23
    Join Date
    Mar 2008
    Posts
    253

    Default

    This time the process of performing the test is very slow.

    The log of hsqldb shows the following output:

    /*C167*/SET SCHEMA PUBLIC
    CONNECT USER SA
    DISCONNECT

    It adds one such output entry every few minutes.

    It feels like the perform test command could take the whole day (it is now running for at least half an hour).
    Stephane

  4. #24
    Join Date
    Mar 2008
    Posts
    253

    Default

    I went back to trying with MySql again as my attempt at using hsqldb did not go very far.

    When I run the tests from the shell with the command: mvn clean install

    I get a lot of these in the console output:

    [WARNING] this affected type is not exposed to the weaver: com.learnintouch.lms.data.domain.Sms [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: com.learnintouch.lms.data.domain.Sms [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: com.learnintouch.lms.data.domain.Sms [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: com.learnintouch.lms.data.domain.Sms [Xlint:typeNotExposedToWeaver]

    In fact I get one for each each domain class.

    And some 87 tests out of 1026 fail due to the fact that they have a unique constraint on a field that is not their primary id.

    Here is again the exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityCons traintViolationException: Duplicate entry '2297' for key 'user_id_2'
    Stephane

  5. #25
    Join Date
    Mar 2008
    Posts
    253

    Default

    So I tried the H2 database and all tests passed fine.

    Tests run: 1026, Failures: 0, Errors: 0, Skipped: 0

    No wonder, the unique constraint that exists in the MySql table structure does not exist in the Spring Roo generated java source code and therefore H2 is not botered by any of it.
    Stephane

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •