Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Another converter-bug

På fredag 05. juli 2013 kl. 20:59:27, skrev Guy Pelletier <guy.pelletier@xxxxxxxxxx>:
Hi Andreas,

I pin pointed the problem internally and will look to have a fix in place soon.

In the mean time, using this descriptor customizer will get you past the error.

package no.officenet.example.eclipselink.autoconvert;

import java.sql.Timestamp;

import org.eclipse.persistence.config.DescriptorCustomizer;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.internal.jpa.metadata.converters.ConverterClass;
import org.eclipse.persistence.mappings.DirectToFieldMapping;


public class CarCustomizer implements DescriptorCustomizer {

    public CarCustomizer() {}

    @Override
    public void customize(ClassDescriptor desc) throws Exception {
        DirectToFieldMapping mapping = (DirectToFieldMapping) desc.getMappingForAttributeName("modified");
       
        mapping.setConverter(new ConverterClass(OptionalJodaDateTimeConverter.class.getName(), false, Timestamp.class.getName(), false));
    }

}


@Entity
@Table(name = "car")
@Customizer(CarCustomizer.class)
public class Car {

...
}
 
Thanks a lot, it works perfectly!
 
Looking forward to having this fixed so auto-applying converters for Scala's Option-types works with a minimum of code:-)
 
I cannot seem to find a source-repo anywhere, only nightly-releases. Is there a source-repo I can pull from and have the fix as soon as you get around to it?
 
Also, while I'm at it (I assume this fix goes into 2.5.1) are there any release-plans for 2.5.1?
 
Thanks!
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
 

Back to the top