1 Reply Latest reply: Sep 12, 2013 9:34 AM by cdelahun RSS

    EclipseLink Converter


      Hi All,


      I have found a typical issue with Eclipse Link Converter.

      For my project I'd to create a converter to convert oracle.sql.RAW field to byte[] and vice-versa for database query.


      1. Entity Class:


      public class SampleEntity {

      private oracle.sql.RAW id = null;   (id being the primary key)





      2. Converter Class:


      public class RawObjectConverter implements Converter {



      public Object convertObjectValueToDataValue(Object objectValue, Session session) {

           if (objectValue instanceof oracle.sql.RAW) {

               return ((oracle.sql.RAW)objectValue).getBytes();


           return objectValue;



        public Object convertDataValueToObjectValue(Object dataValue, Session session) {

            if (dataValue instanceof byte[]) {

               return new oracle.sql.RAW((byte[])dataValue);


            return dataValue;




      Now execution time...


      Case I:  When calling EntityManager.find(<RAW>), the converter's convertObjectValueToDataValue method is getting called and I am getting the result from DB.


      Case II: When calling as below:

      Query query = EntityManager.createQuery(select e from SampleEntity e where e.id = :id)

      query.setParameter("id", <RAW>);



      The Converter's convertObjectValueToDataValue method is NOT getting called and its failing.


      Any idea?