Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.5
  Go To Table Of Contents
 Search
 PDFComments
Comments


@JoinField

Use @JoinField to define a structured data type's foreign key field for an object mapped to NoSql data.


Annotation Elements

Table 2-29 describes this annotation's elements.

Table 2-29 @JoinField Annotation Elements

Annotation Element Description Default

name

(Optional) The name of the foreign key/ID reference field in the source record.


referencedFieldName

(Optional) The name of the ID field in the target record.




Usage

The @JoinField annotation is a generic form of the @JoinColumn annotation, which is not specific to relational databases. You can use @JoinField to map EIS and NoSQL data.


Examples

These examples show how to use this extension as an annotation and in XML.

Example 2-54 Using @JoinField Annotation

@Entity
@NoSql
public class Order {
    ...
    @ManyToOne
    @JoinField(name="customerId")
    private Customer customer;
}

Example 2-55 Using <join-field> in XML

<entity name="Order" class="org.acme.Order">
    <no-sql/>
    ...
    <many-to-one name="customer">
        <join-field name="customerId"/>
    </many-to-one>
</entity>


See Also

For more information, see: