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

OpenJPA ignores custom field strategies globally defined in persistence.xml

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.4.1
    • Component/s: None
    • Labels:
      None

      Description

      I use a custom field strategy value handler (a class that extends org.apache.openjpa.jdbc.meta.strats.AbstractValueHandler) for my entities that make use of joda time fields:

      @Entity
      public class MyEntity {
      org.joda.time.LocalDateTime creationDate;
      }

      When I use the inline strategy annotation (@Strategy("com.xyz.LocalDateValueHandler")), everything works as expected and my LocalDateTime field 'creationDate' gets mapped to an SQL timestamp. However, if I reference my value handler globally in the persistence.xml file, then OpenJPA is not able to find the value handler (i.e., it is never called), which results in a blob column type for 'creationDate'. Here's the corresponding snippet from my persistence.xml:

      <property name="openjpa.jdbc.MappingDefaults" value="FieldStrategies='org.joda.time.LocalDateTime=com.xyz.LocalDateValueHandler"/>

      Note that if I use a mapping from a standard JDK class like java.lang.String to my value handler, then my handler is called as expected. Is this issue somehow related to #OPENJPA-758? Note that I use Derby as my database.

      Any help would be much appreciated.

        Attachments

        1. OPENJPA-2341.patch
          2 kB
          Mark Struberg
        2. OPENJPA-2341-wip-1.patch
          21 kB
          Mark Struberg

          Activity

            People

            • Assignee:
              struberg Mark Struberg
              Reporter:
              mrueegg Michael Rüegg
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: