-->
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: Find an map value and the corresponding object
PostPosted: Sun Apr 08, 2012 9:10 am 
Newbie

Joined: Sun Apr 08, 2012 9:06 am
Posts: 1
I have the two following classes:

Code:
@Entity
public class Book {
    private Long _id;

    private Map<Locale, Title> _translations;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return _id;
    }

    public void setId(final Long id) {
        _id = id;
    }

    @OneToMany(cascade = CascadeType.ALL)
    public Map<Locale, Title> getTranslations() {
        return _translations;
    }

    public void setTranslations(final Map<Locale, Title> translations) {
        _translations = translations;
    }
}


and

Code:
@Entity
public class Title {
    private String _title;

    @Column(nullable = false, unique = true)
    public String getTitle() {
        return _title;
    }

    public void setTitle(final String title) {
        _title = title;
    }
}

I would now try to find a book with a special title string. It does not matter if it is written in HQL, criterias or native SQL.


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.