[jboss-user] [JBoss Seam] - Re: how to make a ejbql query from an entity bean ?

supernovasoftware.com do-not-reply at jboss.com
Mon Dec 3 12:15:45 EST 2007


I use @Formula.  It requires compile time instrumentation for lazy loading and will not load collections unless you use hibernate mapping files.  It works fine with calculated properties and annotations as shown below.

See:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-210

It works well and you can even use the properties in HQL.

Example:
    private Double baseCostPerFt;
  |     @Basic(fetch = FetchType.LAZY)
  |     @Formula(value="( select v.basecostperft from v_item_calc v where v.id = id )")
  |     public Double getBaseCostPerFt() { return baseCostPerFt; }
  |     public void setBaseCostPerFt(Double baseCostPerFt) { this.baseCostPerFt = baseCostPerFt; }
  | 

HQL:
select i from Item i where i.baseCostPerFt>10.59


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

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



More information about the jboss-user mailing list