Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @MappedSuperclass and @Embeddable

We currently do not support Embedabble's inheriting from a MappedSuperclass.

Please vote for the following bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=283028

You can move the @StructConverter definition down to the Embeddable (or some other class) and then add a descriptor customizer to map Basic geometry mapping there, something along the lines of:

DirectToFieldMapping mapping = new DirectToFieldMapping();
mapping.setAttributeName("geometry");
mapping.setGetMethodName("getGeometry");
mapping.setSetMethodName("setGeometry");
mapping.setFieldType(Types.STRUCT);

DatabaseField field = new DatabaseField();
field.setName(""geometry");
field.setColumnDefinition("MDSYS.SDO_GEOMETRY");
mapping.setField(field);

descriptor.addMapping(mapping);

Cheers,
Guy


On 10/09/2010 2:36 AM, Magnus Heino wrote:
Hi.

I have this:

@MappedSuperclass
@Access(AccessType.PROPERTY)
@StructConverter(name = "JGeometryConverter", converter = "se.lantmateriet.origo.domain.model.geometry.OracleGeometryConverter")
public class Point extends FeatureGeometry {

    @Convert("JGeometryConverter")
    @Column(name = "geometry", columnDefinition = "MDSYS.SDO_GEOMETRY")
    public OracleGeometry getGeometry() {
        return this.position.getGeometry();
    }

    protected void setGeometry(final OracleGeometry oracleGeometry) {
        double[] pointCoordinate = oracleGeometry.getGeometry().getFirstPoint();
        this.position = POSITION(N(pointCoordinate[1]), E(pointCoordinate[0]));
    }

}

@Embeddable
public class GeographicLocation extends se.lantmateriet.origo.domain.model.geometry.Point {}


How can GeographicLocation "see" and map geometry from the inherited class? I guess I need some customizer, but what should I put there?

-- 

  /Magnus Heino

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top