我正在尝试使用java + spring + hibernate + jasper报告打印一些按国家分组的城市列表,但是在填充城市分组列表时遇到了一些问题......
我有以下查询:
Query query = session.createQuery("SELECT city FROM DictionaryCity city JOIN city.country as country GROUP BY country ORDER BY country.name ASC");
这总是返回一个城市列表,但具有 1x1 连接,但DictionaryCity
类定义如下:
@Entity
@Table(name = "dictionarycities")
public class DictionaryCity implements IDictionary {
/**
*
*/
private static final long serialVersionUID = 3638441397996216204L;
/**
*
*/
@Id
@Column(name = "Id")
@GeneratedValue
private Long id = null;
/**
*
*/
@Column(name = "Name")
private String name;
/**
*
*/
@ManyToOne(targetEntity = DictionaryCountry.class)
@JoinColumn(name = "CountryId")
private DictionaryCountry country; /** other... **/ }
怎么了?谢谢