-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @MapKey("property.subProperty")
PostPosted: Tue Aug 04, 2009 8:14 pm 
Newbie

Joined: Tue Aug 04, 2009 7:58 pm
Posts: 1
Hi folks.

I'm trying to use the @MapKey in the following way:

Code:
@Entity
public class Image {
    ...
    @OneToMany(mappedBy = "image")
    @MapKey(name  = "property.name")
    private Map<String, PropertyValue> properties = new Hash Map<String, PropertyValue> ();
    ....
}

@Entity
public class Property {
    ...
    @Basic
    private String name;   
    ....
}

@Entity
@IdClass(PropertyValuePk.class)
public class PropertyValue {
    ...
    @Id
    private Property property;

    @Id
    private Image image;

    @Basic
     private String value;   
    ....
}

@Embenddable
public class PropertyValuePk {
     ....
     @ManyToOne
     private Property property;

     @ManyToOne
     private Image image;
    ....
}


But it's not working as expected. Is there a way or a workaround to achieve this?

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.