0 Replies Latest reply on Mar 24, 2009 1:29 PM by John Ament

    Is s:convertEntity doing an implicit update?

    John Ament Master

      So I'm running into this odd issue that pops up.  I have a select one menu..



      <h:selectOneMenu value="#{storeBean.selectedStore}">
                               <s:selectItems value="#{allStores}" noSelectionLabel="Select Store..." 
                               var="store" label="#{store.storeId} - #{store.name}">
                               </s:selectItems>
                               <s:convertEntity />
                          </h:selectOneMenu>



      It ends up generating the following SELECT then UPDATE


          select
              storemaste0_.STORE_ID as STORE1_10_0_,
              storemaste0_.ADDRESS_1 as ADDRESS2_10_0_,
              storemaste0_.ADDRESS_2 as ADDRESS3_10_0_,
              storemaste0_.CITY as CITY10_0_,
              storemaste0_.CLOSING_DATE as CLOSING5_10_0_,
              storemaste0_.COMPANY_NAME as COMPANY6_10_0_,
              storemaste0_.CREATE_DATE as CREATE7_10_0_,
              storemaste0_.CREATE_ID as CREATE8_10_0_,
              storemaste0_.CREATE_PROC as CREATE9_10_0_,
              storemaste0_.DAYS_IN_TRANSIT as DAYS10_10_0_,
              storemaste0_.DC_NO as DC11_10_0_,
              storemaste0_.EXPANSION_DATE as EXPANSION12_10_0_,
              storemaste0_.EXPANSION_SQ_FEET as EXPANSION13_10_0_,
              storemaste0_.GEN_MER_DIST as GEN14_10_0_,
              storemaste0_.GEN_MER_REG_VP as GEN15_10_0_,
              storemaste0_.GEN_MER_REGIONAL as GEN16_10_0_,
              storemaste0_.IC_LIST_ID as IC17_10_0_,
              storemaste0_.LINENS_MER_DIST as LINENS18_10_0_,
              storemaste0_.LOCATION_TYPE as LOCATION19_10_0_,
              storemaste0_.MAX_REOPEN_DATE as MAX20_10_0_,
              storemaste0_.MERCHANDISE_SQ_FEET as MERCHAN21_10_0_,
              storemaste0_.MOD_DATE as MOD22_10_0_,
              storemaste0_.MOD_ID as MOD23_10_0_,
              storemaste0_.MOD_PROC as MOD24_10_0_,
              storemaste0_.NAME as NAME10_0_,
              storemaste0_.OE2_ALLOC_SITE as OE26_10_0_,
              storemaste0_.OE2_NO_STORE_SITE as OE27_10_0_,
              storemaste0_.OE2_REL_SITE as OE28_10_0_,
              storemaste0_.OKAY_TO_ORDER_DATE as OKAY29_10_0_,
              storemaste0_.OKAY_TO_PRINT_LABELS as OKAY30_10_0_,
              storemaste0_.OPENING_DATE as OPENING31_10_0_,
              storemaste0_.PARENT_CHAIN_ID as PARENT32_10_0_,
              storemaste0_.PAYROLL_OPEN_DATE as PAYROLL33_10_0_,
              storemaste0_.PHONE_NUMBER as PHONE34_10_0_,
              storemaste0_.PRIMARY_TAX_RATE as PRIMARY35_10_0_,
              storemaste0_.REAL_ESTATE_TYPE_CODE as REAL36_10_0_,
              storemaste0_.RELOCATION_DATE as RELOCATION37_10_0_,
              storemaste0_.RELOCATION_TO_STORE_ID as RELOCATION38_10_0_,
              storemaste0_.REMODEL_DATE as REMODEL39_10_0_,
              storemaste0_.REMODEL_REASON_CODE as REMODEL40_10_0_,
              storemaste0_.RES_ID as RES41_10_0_,
              storemaste0_.RTV_ID as RTV42_10_0_,
              storemaste0_.SECONDARY_TAX_RATE as SECONDARY43_10_0_,
              storemaste0_.SEND_DOC_PRINT as SEND44_10_0_,
              storemaste0_.SHELF_PRICING_DISABLED as SHELF45_10_0_,
              storemaste0_.SHIP_TO_1 as SHIP46_10_0_,
              storemaste0_.SHIP_TO_2 as SHIP47_10_0_,
              storemaste0_.SHIPPING_ZONE as SHIPPING48_10_0_,
              storemaste0_.STATE as STATE10_0_,
              storemaste0_.STOP_ORDER_DATE as STOP50_10_0_,
              storemaste0_.STORE_INFO as STORE51_10_0_,
              storemaste0_.SYSTEM_MGR as SYSTEM52_10_0_,
              storemaste0_.TAX_LIMIT as TAX53_10_0_,
              storemaste0_.TIME_ZONE as TIME54_10_0_,
              storemaste0_.TOTAL_SQ_FEET as TOTAL55_10_0_,
              storemaste0_.UPS_SHIPPER_ID as UPS56_10_0_,
              storemaste0_.WEB_DISPLAY_DATE as WEB57_10_0_,
              storemaste0_.WM_DC_ID as WM58_10_0_,
              storemaste0_.WMS_ID as WMS59_10_0_,
              storemaste0_.ZIP_4 as ZIP60_10_0_,
              storemaste0_.ZIP_CODE as ZIP61_10_0_ 
          from
              REPMASTER.STORE_MASTER storemaste0_ 
          where
              storemaste0_.STORE_ID=?
      Hibernate: 
          update
              REPMASTER.STORE_MASTER 
          set
              ADDRESS_1=?,
              ADDRESS_2=?,
              CITY=?,
              CLOSING_DATE=?,
              COMPANY_NAME=?,
              CREATE_DATE=?,
              CREATE_ID=?,
              CREATE_PROC=?,
              DAYS_IN_TRANSIT=?,
              DC_NO=?,
              EXPANSION_DATE=?,
              EXPANSION_SQ_FEET=?,
              GEN_MER_DIST=?,
              GEN_MER_REG_VP=?,
              GEN_MER_REGIONAL=?,
              IC_LIST_ID=?,
              LINENS_MER_DIST=?,
              LOCATION_TYPE=?,
              MAX_REOPEN_DATE=?,
              MERCHANDISE_SQ_FEET=?,
              MOD_DATE=?,
              MOD_ID=?,
              MOD_PROC=?,
              NAME=?,
              OE2_ALLOC_SITE=?,
              OE2_NO_STORE_SITE=?,
              OE2_REL_SITE=?,
              OKAY_TO_ORDER_DATE=?,
              OKAY_TO_PRINT_LABELS=?,
              OPENING_DATE=?,
              PARENT_CHAIN_ID=?,
              PAYROLL_OPEN_DATE=?,
              PHONE_NUMBER=?,
              PRIMARY_TAX_RATE=?,
              REAL_ESTATE_TYPE_CODE=?,
              RELOCATION_DATE=?,
              RELOCATION_TO_STORE_ID=?,
              REMODEL_DATE=?,
              REMODEL_REASON_CODE=?,
              RES_ID=?,
              RTV_ID=?,
              SECONDARY_TAX_RATE=?,
              SEND_DOC_PRINT=?,
              SHELF_PRICING_DISABLED=?,
              SHIP_TO_1=?,
              SHIP_TO_2=?,
              SHIPPING_ZONE=?,
              STATE=?,
              STOP_ORDER_DATE=?,
              STORE_INFO=?,
              SYSTEM_MGR=?,
              TAX_LIMIT=?,
              TIME_ZONE=?,
              TOTAL_SQ_FEET=?,
              UPS_SHIPPER_ID=?,
              WEB_DISPLAY_DATE=?,
              WM_DC_ID=?,
              WMS_ID=?,
              ZIP_4=?,
              ZIP_CODE=? 
          where
              STORE_ID=?



      Now, shouldn't be a big deal, except I don't have write access on the schema it's trying to update, only read, so it can't do an update.  Any idea why this is happening?


      Also, is there a better way to do this conversion? the list of objects is coming from the DB already, it seems like a waste to hit it again to get the element.