Hello all,
I am trying to query a view for retreiving some data with the following queries
select new BoComponentsVw(id) from BoComponentsVw boComponentView where boComponentView.id.endItem in('261746','71018AA010')
or from BoComponentsVw boComponentView where boComponentView.id.endItem in('261746','71018AA010')
both are same.
these are the mapping files and entity objects.
<hibernate-mapping> <class name="com.jci.bots.edw.data.BoComponentsVw" table="BO_COMPONENTS_VW" mutable="false"> <composite-id name="id" class="com.jci.bots.edw.data.BoComponentsVwId" > <key-property name="siteNbr" type="string"> <column name="SITE_NBR" length="80" /> </key-property> <key-property name="endItem" type="string"> <column name="END_ITEM" /> </key-property> <key-property name="componentNme" type="string"> <column name="COMPONENT_NME" /> </key-property> <key-property name="componentDsc" type="string"> <column name="COMPONENT_DSC" length="80" /> </key-property> <key-property name="componentUom" type="string"> <column name="COMPONENT_UOM" length="20" /> </key-property> <key-property name="invoiceUnitPrice" type="big_decimal"> <column name="INVOICE_UNIT_PRICE" precision="22" scale="0" /> </key-property> <key-property name="supplierSapNbr" type="string"> <column name="SUPPLIER_SAP_NBR" length="20" /> </key-property> <key-property name="supplierName" type="string"> <column name="SUPPLIER_NAME" length="128" /> </key-property> <key-property name="scheduleAgreementNbr" type="string"> <column name="SCHEDULE_AGREEMENT_NBR" length="35" /> </key-property> <key-property name="scheduleAgreementLineNbr" type="string"> <column name="SCHEDULE_AGREEMENT_LINE_NBR" length="6" /> </key-property> <key-property name="currencyCd" type="string"> <column name="CURRENCY_CD" length="30" /> </key-property> </composite-id> </class>
---------------------entity objects ---------------------------
public class BoComponentsVw implements java.io.Serializable {
private BoComponentsVwId id;
public BoComponentsVw() { }
public BoComponentsVw(BoComponentsVwId id) { this.id = id; System.out.println(id); }
public BoComponentsVwId getId() { return this.id; }
public void setId(BoComponentsVwId id) { this.id = id; }
}
-------------------id class--------------
public class BoComponentsVwId implements java.io.Serializable {
private String siteNbr; private String endItem; private String componentNme; private String componentDsc; private String componentUom; private BigDecimal invoiceUnitPrice; private String supplierSapNbr; private String supplierName; private String scheduleAgreementNbr; private String scheduleAgreementLineNbr; private String currencyCd; .............
it has getters setters and constructors
Now when Itry to do this
List<BoComponentsVw> bocVwList = query.list();
for(BoComponentsVw bocvw1 : bocVwList){ System.out.println(bocvw1.getId());//.getComponentDsc()); }
I get null printed, I dont understand why it is giving null for the getId().
Is there something to be remembered when I handle views.
BTW, I have generated the hbm and java classes using hibernate reverse engineering tool
|