Hi,
Here is my table schema and java code:
table
NEWS
Code:
|NEWS_ID|
| 37 |
table
NEWS_PHOTO_DESCCode:
| NEWS_ID | PHOTO_ID | DESCRIPTION |
| 37 | 47 | desc1 |
| 37 | 48 | null |
and here is my class
NewsVOCode:
@Entity
@Table(name = "NEWS")
class NewsVO {
@Id
@Column(name = "NEWS_ID")
private long newsId;
@CollectionOfElements
@JoinTable(name = "NEWS_PHOTO_DESC", joinColumns = { @JoinColumn(name = "NEWS_ID") })
@MapKey(columns = { @Column(name = "PHOTO_ID") })
@Column(name = "DESCRIPTION")
private Map<Long, String> photos = new HashMap<Long, String>();
.....
}
when my dao fetch the result
Code:
NewsVO entity = dao.fetch(37);
Map<Long, String> photos = entity.getPhotos();
the photos only return {47, desc1},
why not return {{47, desc1}, {48, null}}?
Does the map don't allow null value?