Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] StaticMetamodel and joda.time.Interval with EclipseLink

I have and Entity using an EclipseLink (v2.5.2) specific Transformation:

    @Transformation(fetch = FetchType.LAZY)
    @ReadTransformer(method = "readValidityInterval")
    @WriteTransformers({
        @WriteTransformer(method = "writeValidityIntervalStart", column = @Column(name = "validityinterval_0")),
        @WriteTransformer(method = "writeValidityIntervalEnd", column = @Column(name = "validityinterval"))
    })
    private Interval validityInterval;

metaModel:

    public static volatile SingularAttribute<Entity, org.joda.time.Interval> validityInterval;   

I can set and read to the database fine using the getters and setters, but when I try to use the metamodel for a query, the Path returns a java.lang.Object instead of joda.time.Interval for the javaType (I imagine this is a default). 

    Path<Interval> test2 = singularAttribute.<Interval>get("validityInterval");

`typedQuery.unwrap(JpaQuery.class).getDatabaseQuery().getSQLString()` returns null, 
then `typedQuery.getResultList()` fails.

If I use:

    get.(Entity_.validityInterval)

it fails fast with:

     No [ManagedType] was found for the key class [java.lang.Object] in the Metamodel - 
    please verify that the [Managed] class was referenced in persistence.xml using a 
    specific <class>com.foo.data.model.User</class> property or a global <exclude-unlisted-
    classes>false</exclude-unlisted-classes> element.

Is there something I'm missing for TransformationMapping and metamodels? 

Back to the top