2020-04-24

Hibernate JPA @AnyMetaDef annotation Example

@AnyMetaDef

The @AnyMetaDef annotation is used to provide metadata about an @Any or @ManyToAny mapping.

AnyMetaDef Used to provide metadata about an Any or ManyToAny mapping.

String idType
Names the identifier Hibernate Type for the entity associated through this Any/ManyToAny mapping.

String metaType
Names the discriminator Hibernate Type for this Any/ManyToAny mapping.

MetaValue[] metaValues
Maps discriminator values to the matching corresponding entity types.

@AnyMetaDef( name= "PropertyMetaDef", metaType = "string", idType = "long",
    metaValues = {
            @MetaValue(value = "S", targetEntity = StringProperty.class),
            @MetaValue(value = "I", targetEntity = IntegerProperty.class)
        }
    )
package org.hibernate.userguide.associations.any;

import org.hibernate.annotations.AnyMetaDef;
import org.hibernate.annotations.MetaValue;

No comments:

Post a Comment