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.