Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-440

Calendar instance doesn't appear to detach properly (or proxying of it is in error?)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0, 1.1.0
    • 1.1.0
    • None
    • None
    • fedora 7, java full version "1.6.0_03-b05", Spring 2.0.7, Mysql 5.0.45, mysql connector 5.0.5

    Description

      I have an @entity object which has a field

      @Temporal(TemporalType.DATE)
      private Calendar aquisitionDate = null;

      I can set the Calendar field fine and it persists fine into the database.

      If I start a new transaction and read the object back out of the database,

      when the transaction is still open everything works fine, I can call
      getTimeInMillis() = 1153108800000
      get(Calendar.YEAR) = 2006
      get(Calendar.MONTH) 6
      get(Calendar.DAY_OF_MONTH) = 17
      which is all correct

      After I close the transaction,
      getTimeInMillis() = 1153181684943 (why did it change? I didn't change the data)
      get(Calendar.YEAR) = ERROR

      <openjpa-1.1.0-SNAPSHOT-r420667:570593 fatal user error> org.apache.openjpa.persistence.InvalidStateException: The context has been closed. The stack trace at which the context was closed is available if Runtime=TRACE logging is enabled.
      at org.apache.openjpa.kernel.BrokerImpl.assertOpen(BrokerImpl.java:4291)
      at org.apache.openjpa.kernel.BrokerImpl.beginOperation(BrokerImpl.java:1702)
      at org.apache.openjpa.kernel.BrokerImpl.isActive(BrokerImpl.java:1672)
      at org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1524)
      at org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1471)
      at org.apache.openjpa.util.Proxies.dirty(Proxies.java:66)
      at org.apache.openjpa.util.java$util$GregorianCalendar$proxy.computeFields(Unknown Source)
      at java.util.Calendar.complete(Calendar.java:1522)
      at java.util.Calendar.get(Calendar.java:1126)
      at com.XXXXX.dao.ItemTest.itemTest(ItemTest.java:46)

      Attachments

        Activity

          People

            Unassigned Unassigned
            tedman@sfu.ca Ted Leung
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: