Hi,
My project is using springframework & hibernate.
In one of the mapping files, i have a requirement of a field in xml, which should not be mapped with any column of database but should be the sum of four columns of database. the code is as follows
<property name="total" formula="(select QUARTER_1 + QUARTER_2 + QUARTER_3 + QUARTER_4 from epr_finance f where f.promotion_id = PROMOTION_ID and f.attribute_id = ATTRIBUTE_ID)" type="double">
<meta attribute="property-type">java.lang.Double</meta>
</property>
I m getting the following error::
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: properties of components may not be formulas: total
net.sf.hibernate.MappingException: properties of components may not be formulas: total
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:882)
How can i resolve this ??
|