-->
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: Does the MAP of @CollectionOfElements not allow null value?
PostPosted: Mon Sep 15, 2008 8:14 am 
Newbie

Joined: Mon Sep 15, 2008 7:36 am
Posts: 1
Hi,
Here is my table schema and java code:

table NEWS
Code:
|NEWS_ID|
|  37 |

table NEWS_PHOTO_DESC
Code:
| NEWS_ID | PHOTO_ID | DESCRIPTION |
|  37  |   47  |   desc1   |
|  37  |   48  |   null   |


and here is my class NewsVO
Code:
@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?


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.