[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Accessing collections from queries

alexg79 do-not-reply at jboss.com
Fri Aug 3 14:17:26 EDT 2007


Please help, I've asked a similar question several times and it's never been answered!

Suppose I have an entity like:
@Entity
  | class Delivery {
  |   private long id;
  |   private Map<Date, Integer> amounts;
  | 
  |   @Id @GeneratedValue
  |   public long getId() {
  |     return id;
  |   }
  | 
  |   public void setId(long id) {
  |     this.id = id;
  |   }
  | 
  |   @CollectionOfElements
  |   public Map<Date, Integer> getAmounts() {
  |     return amounts;
  |   }
  | 
  |   public void setAmounts(Map<Date, Integer> amounts) {
  |     this.amounts = amounts;
  |   }
  | 
  | }
How can I access the "amounts" property in queries?
I'd like to create an aggregate query that gives me a sum of delivered amounts per delivery. How do I do that?
How can I even retrieve the value of "amounts" from a Criteria Query using a Projection?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070745#4070745

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070745



More information about the jboss-user mailing list