castor
  1. castor
  2. CASTOR-2326

Can't use Database.load(...) when all the columns in the table are part of the primary key

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3 rc1
    • Component/s: JDO
    • Labels:
      None
    • Environment:
      Windows, jtds-1.2.2.jar, MSSQL 2005, JDK is 1.4.2_08 from SUN
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      I'm getting this error when use the Database.load(...) when my table has only columns wich are part of the primary key:

      java.lang.IllegalStateException: Transaction org.castor.persist.LocalTransactionContext@147c1db does not hold the read lock
      ...
      java.lang.ArrayIndexOutOfBoundsException: 0
      at org.exolab.castor.jdo.engine.SQLStatementLoad.executeStatement(SQLStatementLoad.java:332)
      at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:349)
      ...

      The table the unitTest:

      create table FSIM17(
      NUMCIA decimal(3,0) NOT NULL,
      NUMALM decimal(3,0) NOT NULL,
      IPWAS CHAR(15) NOT NULL,
      primary key (NUMCIA,NUMALM,IPWAS)
      )

      1. castorTest.7z
        18 kB
        Victor Manuel Iniestra Alvarez
      2. patch.c2326.20080411.txt
        0.7 kB
        Werner Guttmann

        Issue Links

          Activity

          Hide
          Werner Guttmann added a comment -

          Initial patch for review.

          Show
          Werner Guttmann added a comment - Initial patch for review.
          Hide
          Werner Guttmann added a comment -

          As can be seen in the patch easily, an additional null check resolved the problem. I still have to add anew test case so that we are not going to be hit by this problem again.

          Show
          Werner Guttmann added a comment - As can be seen in the patch easily, an additional null check resolved the problem. I still have to add anew test case so that we are not going to be hit by this problem again.
          Hide
          Victor Manuel Iniestra Alvarez added a comment -

          It works on my enviroment. Thanks.

          Show
          Victor Manuel Iniestra Alvarez added a comment - It works on my enviroment. Thanks.
          Hide
          Werner Guttmann added a comment -

          Does that imply that you built the binaries yourself from SVN trunk after I have committed the patch ?

          Show
          Werner Guttmann added a comment - Does that imply that you built the binaries yourself from SVN trunk after I have committed the patch ?
          Hide
          Victor Manuel Iniestra Alvarez added a comment -

          Yes, it does. I downloaded the sources a week ago.

          Show
          Victor Manuel Iniestra Alvarez added a comment - Yes, it does. I downloaded the sources a week ago.
          Hide
          Werner Guttmann added a comment -

          In that case, you might want to close this issue to let us know you have tested our resolution and are happy about this.

          Show
          Werner Guttmann added a comment - In that case, you might want to close this issue to let us know you have tested our resolution and are happy about this.

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Victor Manuel Iniestra Alvarez
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour, 30 minutes
                1h 30m
                Remaining:
                Time Spent - 1 hour, 25 minutes Remaining Estimate - 5 minutes
                5m
                Logged:
                Time Spent - 1 hour, 25 minutes Remaining Estimate - 5 minutes
                1h 25m