[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-28) @Any

Alain Mahier (JIRA) noreply at atlassian.com
Sun Jun 24 11:18:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27314 ] 

Alain Mahier commented on ANN-28:
---------------------------------

Added AnyParticipant, AnyParticipants, and name to Any or ManyToAny associations.

It allows to define an any association in an entity packaged in a jar and have entities in an external jar to participate with this any annotation. This is usefull when demarcation of entities is desired when developing multiple applications, and those jars are integrated at deployed time with a session factory that loads enities from multiple jars.

For example,

you can have 

@Entity
@Table(name = "char_property")
@AnyParticipants(value = {
    @AnyParticipant(anyName = "PropertyList.someProperty", value = @MetaValue(value = "C", targetEntity = CharProperty.class)),
    @AnyParticipant(anyName = "PropertyList.generalProperties", value = @MetaValue(value = "C", targetEntity = CharProperty.class)) })
public class CharProperty implements Property {
    private Integer id;

...
}


@Entity
@Table(name = "property_list")
public class PropertyList<T extends Property> {
    private Integer id;

...

    @ManyToAny(nameRef = "PropertyList.generalProperties", idType = "integer", metaType = "string", columns = {
        @Column(name = "property_type"), @Column(name = "property_id") })
    @Cascade( { org.hibernate.annotations.CascadeType.ALL })
    @JoinTable(name = "list_properties", joinColumns = { @JoinColumn(name = "obj_id") })
    @IndexColumn(name = "prop_index")
    public List<T> getGeneralProperties() {
        return generalProperties;
    }

...

    @Any(nameRef = "PropertyList.someProperty", idType = "integer", metaType = "string", columns = {
        @Column(name = "property_type"), @Column(name = "property_id") }, metaDataClass = Property.class, cascade = CascadeType.ALL)
    public T getSomeProperty() {
        return someProperty;
    }

...
}

> @Any
> ----
>
>                 Key: ANN-28
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-28
>             Project: Hibernate Annotations
>          Issue Type: Patch
>          Components: binder
>    Affects Versions: 3.1beta3
>            Reporter: Emmanuel Bernard
>            Assignee: Emmanuel Bernard
>            Priority: Trivial
>             Fix For: 3.3.1
>
>         Attachments: annotations-any-patch.txt, annotations-any-patch2.txt, annotations-any-patch3.txt
>
>
> @AnyValue(value="", class="") //or MetaValue?
> @Any(idType="", metaType="", metaValues={@MetaValue()}, columns={@Column()})

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list