Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2577

In what case [code=17041, state=99999] SQLException returns during lazy fetching?

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Open
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: jpa
    • Labels:
    • Environment:
      JSF application with EJB 3 and open JPA, running on websphere 8.5
    • Flags:
      Important

      Description

      Hi,

      In production environment once we got below exception. we are not able to reproduce the problem. That application is stopped using in production due to few issues, out of them one is this.

      I tried to replicate this in many ways on production data dump. but i am not able to replicate.

      To recreate data to replicate, i want to know when this exception is thrown by JPA framework?

      Exception is:
      [2014-10-28 13:04:15:209 CET] 0000003c BusinessExcep E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "calculateCompensations" on bean "BeanId(me-std-ear#me-std-web.war#MEFacadeBean, null)". Exception data: <openjpa-2.1.2-SNAPSHOT-r422266:1436521 nonfatal general error> org.apache.openjpa.util.GeneralException: org.apache.openjpa.lib.jdbc.ReportingSQLException: IN- eller OUT-parameter saknas i index:: 1

      {prepstmnt 1296099302 SELECT t0.EXTERNAL_ID, t0.LAST_UPDATED, t0.NAME, t0.UOM FROM ITEM t0 WHERE t0.ITEM_ID = ? [params=?]}

      [code=17041, state=99999]
      at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1008)
      at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:907)
      at com.ibm.ws.persistence.kernel.WsJpaBrokerImpl.find(WsJpaBrokerImpl.java:199)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.find(JDBCStoreManager.java:1010)
      at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.load(RelationFieldStrategy.java:781)
      at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:934)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:702)
      at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:130)
      at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:117)
      at org.apache.openjpa.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:442)
      at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:117)
      at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
      at org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3061)
      at org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:3136)
      at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1606)
      at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1591)
      at se.ica.me.entity.OfferPartItem.pcGetitem(OfferPartItem.java)
      at se.ica.me.entity.OfferPartItem.getItem(OfferPartItem.java:59)
      at se.ica.me.dao.SaleDAO.getItemsFrom(SaleDAO.java:100)
      at se.ica.me.dao.SaleDAO.getClusterTotalSaleForItem(SaleDAO.java:50)

      SaleDao.java Code is as below:

      private Set<Item> getItemsFrom(List<OfferPartItem> offerPartItems) {
      Set<Item> items = new HashSet<Item>();
      for(OfferPartItem offerPartItem : offerPartItems)

      { items.add(offerPartItem.getItem()); }

      return items;
      }

      OfferPartItem.java entity code:

      @Entity
      @Table(name="OFFER_PART_ITEM")
      public class OfferPartItem implements Serializable {
      private static final long serialVersionUID = 1L;

      @Id
      @GeneratedValue(strategy = SEQUENCE, generator = "OFFER_PART_ITEM_SEQ_GNR")
      @SequenceGenerator(name = "OFFER_PART_ITEM_SEQ_GNR", sequenceName = "OFFER_PART_ITEM_SEQ")
      @Column(name="OFFER_PART_ITEM_ID")
      private Long offerPartItemId;

      @Column(name="COST_PRICE")
      private BigDecimal costPrice;

      @ManyToOne(fetch=FetchType.LAZY)
      @JoinColumn(name="ITEM_ID")
      private Item item;

      public Item getItem()

      { return this.item; }

      Item entity code:
      @Entity
      @Table(name="ITEM")
      @NamedQueries(

      { @NamedQuery(name = "Item.findByExternalId", query = "SELECT i FROM Item i where i.externalId = :externalId") }

      )
      public class Item implements Serializable

      { private static final long serialVersionUID = 1L; public static final String NQ_FIND_BY_EXTERNAL_ID = "Item.findByExternalId"; @Id @GeneratedValue(strategy=SEQUENCE, generator = "ITEM_SEQ_GNR") @SequenceGenerator(name = "ITEM_SEQ_GNR", sequenceName = "ITEM_SEQ") @Column(name="ITEM_ID") private Long itemId; /** * ICA StoreItem-identifier */ @Column(name="EXTERNAL_ID", length=20) private String externalId; @Column(name="NAME", length=20) private String name; ... ... }

      Table structures
      Offer_Part_Item
      OFFER_PART_ITEM_ID N NUMBER (Primary key)
      ITEM_ID Y NUMBER (Foreigh key of ITEM table)
      OFFER_PART_ID Y NUMBER
      COST_PRICE Y NUMBER
      SALE_ID Y NUMBER

      Your early help is very much appreciated.

      Regards,
      Rashmi

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rashmi02 rashmi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: