//
// JOnASProductBeanBean.java
// DO NOT EDIT THIS FILE
// It is automatically generated via the GenIC tool of JOnAS
//

package com.hbsrx.ejb.entity;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Enumeration;
import java.util.Vector;

import javax.ejb.EJBException;
import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
import javax.ejb.ObjectNotFoundException;
import javax.sql.DataSource;

import org.objectweb.jonas_ejb.container.TraceEjb;
import org.objectweb.jonas_ejb.container.JEntityHome;
import org.objectweb.jonas_ejb.lib.MarshallTool;

public class JOnASProductBeanBean extends com.hbsrx.ejb.entity.ProductBean {

    private EntityContext ejbContext = null;
    private JEntityHome ejbHome = null;

    public void setEntityContext(javax.ejb.EntityContext p1) throws java.rmi.RemoteException {
        TraceEjb.debugGenIC("JOnASProductBeanBean.setEntityContext(javax.ejb.EntityContext)");
        this.ejbContext = p1;
        this.ejbHome = (JEntityHome)p1.getEJBHome();
        super.setEntityContext(p1);
    }


    private boolean isModifiedData() {
        boolean b = true;
        TraceEjb.debugGenIC("JOnASProductBeanBean.isModifiedData() --> " + b);
        return(b);
    }


    public com.hbsrx.ejb.entity.ProductPK ejbCreate(com.hbsrx.ejb.entity.data.ProductData p1) {
        TraceEjb.debugGenIC("JOnASProductBeanBean.ejbCreate(com.hbsrx.ejb.entity.data.ProductData)");
        this.prodNum = 0L;
        this.shipType = null;
        this.prodType = 0;
        this.prodRxRequired = null;
        this.prodNdcNum = null;
        this.prodCatelogNum = null;
        this.prcTableNum = null;
        this.prodTaxable = null;
        this.mfgNum = null;
        this.theraputicClass = null;
        this.prodCreateDate = null;
        this.prodInactive = null;
        this.prodInactiveEffectiveDate = null;
        this.prodLastChangeDate = null;
        this.prodUnits = null;
        this.prodFormDesc = null;
        this.prodStrength = null;
        this.prodUnitPackageItem = null;
        this.prodLotTrackMandatory = null;
        this.prodLastSaleDate = null;
        this.prodMinQtyDispense = null;
        this.prodMaxQtyDispense = null;
        this.prodCompound = null;
        this.prodCompoundAutoPrice = null;
        this.prodCompoundPrintLabel = null;
        this.prodGeneric = null;
        this.prodNoGen = null;
        this.prodNarcCode = null;
        this.prodDefDays = null;
        this.prodDefInstructions = null;
        this.prodDefQty = null;
        this.prodPaMedicaidExempt = null;
        this.prodSigDefinition = null;
        this.prodStateFormularyCode = null;
        this.prodKdcNum = null;
        this.prodGcnNum = null;
        this.prodLomnReq = null;
        this.prodVialQty = null;
        this.prodReportCode = null;
        this.prodPriorAuth = null;
        this.prodNoLabel = null;
        this.prodAutoUpdate = null;
        this.prodUnitOfUse = null;
        this.prodNoAcqWhlUpd = null;
        this.prodSex = null;
        this.prodAge = null;
        this.prodRevenueCode = null;
        this.prodActiveProd = null;
        this.prodTheraputicSub = null;
        this.prodUtilizationProd = null;
        this.prCode = null;
        this.prodPickedFlierCode = null;
        this.prodMedicareCover = null;
        this.prodMetricDecimalQty = null;
        this.prodGpi = null;
        this.prodCompoundFee = null;
        this.prodMinAge = null;
        this.prodCommentId = null;
        this.prodMethamphetamine = null;
        this.prodPkgQty = null;
        this.prodHazmat = null;
        this.prodTaxwareCategory = null;
        super.ejbCreate(p1);
        com.hbsrx.ejb.entity.ProductPK pk;
        pk = new com.hbsrx.ejb.entity.ProductPK();
        pk.prodNum = this.prodNum;
        if (this.ejbHome.getEJBObject(pk) != null) {
            throw new javax.ejb.DuplicateKeyException(pk.toString());
        }
        Connection conn = null;
        PreparedStatement pStmt = null;
        try {
            DataSource ds = (DataSource)(this.ejbHome.getDataSource());
            conn = ds.getConnection();
            pStmt = conn.prepareStatement("insert into PRODUCT (prod_num, ship_type, prod_type, prod_rx_required, prod_ndc_num, prod_catelog_num, prc_table_num, prod_taxable, mfg_num, theraputic_class, prod_create_date, prod_inactive, prod_inactive_effective_date, prod_last_change_date, prod_units, prod_form_desc, prod_strength, prod_unit_package_item, prod_lot_track_mandatory, prod_last_sale_date, prod_min_qty_dispense, prod_max_qty_dispense, prod_compound, prod_compound_auto_price, prod_compound_print_label, prod_generic, prod_no_gen, prod_narc_code, prod_def_days, prod_def_instructions, prod_def_qty, prod_pa_medicaid_exempt, prod_sig_definition, prod_state_formulary_code, prod_kdc_num, prod_gcn_num, prod_lomn_req, prod_vial_qty, prod_report_code, prod_prior_auth, prod_no_label, prod_auto_update, prod_unit_of_use, prod_no_acq_whl_upd, prod_sex, prod_age, prod_revenue_code, prod_active_prod, prod_theraputic_sub, prod_utilization_prod, pr_code, prod_picked_flier_code, prod_medicare_cover, prod_metric_decimal_qty, prod_gpi, prod_compound_fee, prod_min_age, prod_comment_id, prod_methamphetamine, prod_pkg_qty, prod_hazmat, prod_taxware_category) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
            pStmt.setLong(1, this.prodNum);
            if (this.shipType == null) {
                pStmt.setNull(2, Types.INTEGER);
            } else {
                pStmt.setObject(2, (java.lang.Object)this.shipType);
            }
            pStmt.setInt(3, this.prodType);
            if (this.prodRxRequired == null) {
                pStmt.setNull(4, Types.VARCHAR);
            } else {
                pStmt.setString(4, this.prodRxRequired);
            }
            if (this.prodNdcNum == null) {
                pStmt.setNull(5, Types.BIGINT);
            } else {
                pStmt.setObject(5, (java.lang.Object)this.prodNdcNum);
            }
            if (this.prodCatelogNum == null) {
                pStmt.setNull(6, Types.VARCHAR);
            } else {
                pStmt.setString(6, this.prodCatelogNum);
            }
            if (this.prcTableNum == null) {
                pStmt.setNull(7, Types.BIGINT);
            } else {
                pStmt.setObject(7, (java.lang.Object)this.prcTableNum);
            }
            if (this.prodTaxable == null) {
                pStmt.setNull(8, Types.VARCHAR);
            } else {
                pStmt.setString(8, this.prodTaxable);
            }
            if (this.mfgNum == null) {
                pStmt.setNull(9, Types.INTEGER);
            } else {
                pStmt.setObject(9, (java.lang.Object)this.mfgNum);
            }
            if (this.theraputicClass == null) {
                pStmt.setNull(10, Types.INTEGER);
            } else {
                pStmt.setObject(10, (java.lang.Object)this.theraputicClass);
            }
            if (this.prodCreateDate == null) {
                pStmt.setNull(11, Types.TIMESTAMP);
            } else {
                pStmt.setTimestamp(11, this.prodCreateDate);
            }
            if (this.prodInactive == null) {
                pStmt.setNull(12, Types.VARCHAR);
            } else {
                pStmt.setString(12, this.prodInactive);
            }
            if (this.prodInactiveEffectiveDate == null) {
                pStmt.setNull(13, Types.TIMESTAMP);
            } else {
                pStmt.setTimestamp(13, this.prodInactiveEffectiveDate);
            }
            if (this.prodLastChangeDate == null) {
                pStmt.setNull(14, Types.TIMESTAMP);
            } else {
                pStmt.setTimestamp(14, this.prodLastChangeDate);
            }
            if (this.prodUnits == null) {
                pStmt.setNull(15, Types.INTEGER);
            } else {
                pStmt.setObject(15, (java.lang.Object)this.prodUnits);
            }
            if (this.prodFormDesc == null) {
                pStmt.setNull(16, Types.VARCHAR);
            } else {
                pStmt.setString(16, this.prodFormDesc);
            }
            if (this.prodStrength == null) {
                pStmt.setNull(17, Types.BIGINT);
            } else {
                pStmt.setObject(17, (java.lang.Object)this.prodStrength);
            }
            if (this.prodUnitPackageItem == null) {
                pStmt.setNull(18, Types.VARCHAR);
            } else {
                pStmt.setString(18, this.prodUnitPackageItem);
            }
            if (this.prodLotTrackMandatory == null) {
                pStmt.setNull(19, Types.VARCHAR);
            } else {
                pStmt.setString(19, this.prodLotTrackMandatory);
            }
            if (this.prodLastSaleDate == null) {
                pStmt.setNull(20, Types.TIMESTAMP);
            } else {
                pStmt.setTimestamp(20, this.prodLastSaleDate);
            }
            if (this.prodMinQtyDispense == null) {
                pStmt.setNull(21, Types.BIGINT);
            } else {
                pStmt.setObject(21, (java.lang.Object)this.prodMinQtyDispense);
            }
            if (this.prodMaxQtyDispense == null) {
                pStmt.setNull(22, Types.BIGINT);
            } else {
                pStmt.setObject(22, (java.lang.Object)this.prodMaxQtyDispense);
            }
            if (this.prodCompound == null) {
                pStmt.setNull(23, Types.VARCHAR);
            } else {
                pStmt.setString(23, this.prodCompound);
            }
            if (this.prodCompoundAutoPrice == null) {
                pStmt.setNull(24, Types.VARCHAR);
            } else {
                pStmt.setString(24, this.prodCompoundAutoPrice);
            }
            if (this.prodCompoundPrintLabel == null) {
                pStmt.setNull(25, Types.VARCHAR);
            } else {
                pStmt.setString(25, this.prodCompoundPrintLabel);
            }
            if (this.prodGeneric == null) {
                pStmt.setNull(26, Types.VARCHAR);
            } else {
                pStmt.setString(26, this.prodGeneric);
            }
            if (this.prodNoGen == null) {
                pStmt.setNull(27, Types.VARCHAR);
            } else {
                pStmt.setString(27, this.prodNoGen);
            }
            if (this.prodNarcCode == null) {
                pStmt.setNull(28, Types.INTEGER);
            } else {
                pStmt.setObject(28, (java.lang.Object)this.prodNarcCode);
            }
            if (this.prodDefDays == null) {
                pStmt.setNull(29, Types.INTEGER);
            } else {
                pStmt.setObject(29, (java.lang.Object)this.prodDefDays);
            }
            if (this.prodDefInstructions == null) {
                pStmt.setNull(30, Types.VARCHAR);
            } else {
                pStmt.setString(30, this.prodDefInstructions);
            }
            if (this.prodDefQty == null) {
                pStmt.setNull(31, Types.INTEGER);
            } else {
                pStmt.setObject(31, (java.lang.Object)this.prodDefQty);
            }
            if (this.prodPaMedicaidExempt == null) {
                pStmt.setNull(32, Types.VARCHAR);
            } else {
                pStmt.setString(32, this.prodPaMedicaidExempt);
            }
            if (this.prodSigDefinition == null) {
                pStmt.setNull(33, Types.VARCHAR);
            } else {
                pStmt.setString(33, this.prodSigDefinition);
            }
            if (this.prodStateFormularyCode == null) {
                pStmt.setNull(34, Types.VARCHAR);
            } else {
                pStmt.setString(34, this.prodStateFormularyCode);
            }
            if (this.prodKdcNum == null) {
                pStmt.setNull(35, Types.INTEGER);
            } else {
                pStmt.setObject(35, (java.lang.Object)this.prodKdcNum);
            }
            if (this.prodGcnNum == null) {
                pStmt.setNull(36, Types.VARCHAR);
            } else {
                pStmt.setString(36, this.prodGcnNum);
            }
            if (this.prodLomnReq == null) {
                pStmt.setNull(37, Types.VARCHAR);
            } else {
                pStmt.setString(37, this.prodLomnReq);
            }
            if (this.prodVialQty == null) {
                pStmt.setNull(38, Types.INTEGER);
            } else {
                pStmt.setObject(38, (java.lang.Object)this.prodVialQty);
            }
            if (this.prodReportCode == null) {
                pStmt.setNull(39, Types.VARCHAR);
            } else {
                pStmt.setString(39, this.prodReportCode);
            }
            if (this.prodPriorAuth == null) {
                pStmt.setNull(40, Types.VARCHAR);
            } else {
                pStmt.setString(40, this.prodPriorAuth);
            }
            if (this.prodNoLabel == null) {
                pStmt.setNull(41, Types.VARCHAR);
            } else {
                pStmt.setString(41, this.prodNoLabel);
            }
            if (this.prodAutoUpdate == null) {
                pStmt.setNull(42, Types.VARCHAR);
            } else {
                pStmt.setString(42, this.prodAutoUpdate);
            }
            if (this.prodUnitOfUse == null) {
                pStmt.setNull(43, Types.INTEGER);
            } else {
                pStmt.setObject(43, (java.lang.Object)this.prodUnitOfUse);
            }
            if (this.prodNoAcqWhlUpd == null) {
                pStmt.setNull(44, Types.VARCHAR);
            } else {
                pStmt.setString(44, this.prodNoAcqWhlUpd);
            }
            if (this.prodSex == null) {
                pStmt.setNull(45, Types.VARCHAR);
            } else {
                pStmt.setString(45, this.prodSex);
            }
            if (this.prodAge == null) {
                pStmt.setNull(46, Types.INTEGER);
            } else {
                pStmt.setObject(46, (java.lang.Object)this.prodAge);
            }
            if (this.prodRevenueCode == null) {
                pStmt.setNull(47, Types.INTEGER);
            } else {
                pStmt.setObject(47, (java.lang.Object)this.prodRevenueCode);
            }
            if (this.prodActiveProd == null) {
                pStmt.setNull(48, Types.BIGINT);
            } else {
                pStmt.setObject(48, (java.lang.Object)this.prodActiveProd);
            }
            if (this.prodTheraputicSub == null) {
                pStmt.setNull(49, Types.BIGINT);
            } else {
                pStmt.setObject(49, (java.lang.Object)this.prodTheraputicSub);
            }
            if (this.prodUtilizationProd == null) {
                pStmt.setNull(50, Types.BIGINT);
            } else {
                pStmt.setObject(50, (java.lang.Object)this.prodUtilizationProd);
            }
            if (this.prCode == null) {
                pStmt.setNull(51, Types.VARCHAR);
            } else {
                pStmt.setString(51, this.prCode);
            }
            if (this.prodPickedFlierCode == null) {
                pStmt.setNull(52, Types.INTEGER);
            } else {
                pStmt.setObject(52, (java.lang.Object)this.prodPickedFlierCode);
            }
            if (this.prodMedicareCover == null) {
                pStmt.setNull(53, Types.VARCHAR);
            } else {
                pStmt.setString(53, this.prodMedicareCover);
            }
            if (this.prodMetricDecimalQty == null) {
                pStmt.setNull(54, Types.INTEGER);
            } else {
                pStmt.setObject(54, (java.lang.Object)this.prodMetricDecimalQty);
            }
            if (this.prodGpi == null) {
                pStmt.setNull(55, Types.BIGINT);
            } else {
                pStmt.setObject(55, (java.lang.Object)this.prodGpi);
            }
            if (this.prodCompoundFee == null) {
                pStmt.setNull(56, Types.BIGINT);
            } else {
                pStmt.setObject(56, (java.lang.Object)this.prodCompoundFee);
            }
            if (this.prodMinAge == null) {
                pStmt.setNull(57, Types.INTEGER);
            } else {
                pStmt.setObject(57, (java.lang.Object)this.prodMinAge);
            }
            if (this.prodCommentId == null) {
                pStmt.setNull(58, Types.BIGINT);
            } else {
                pStmt.setObject(58, (java.lang.Object)this.prodCommentId);
            }
            if (this.prodMethamphetamine == null) {
                pStmt.setNull(59, Types.VARCHAR);
            } else {
                pStmt.setString(59, this.prodMethamphetamine);
            }
            if (this.prodPkgQty == null) {
                pStmt.setNull(60, Types.INTEGER);
            } else {
                pStmt.setObject(60, (java.lang.Object)this.prodPkgQty);
            }
            if (this.prodHazmat == null) {
                pStmt.setNull(61, Types.VARCHAR);
            } else {
                pStmt.setString(61, this.prodHazmat);
            }
            if (this.prodTaxwareCategory == null) {
                pStmt.setNull(62, Types.VARCHAR);
            } else {
                pStmt.setString(62, this.prodTaxwareCategory);
            }
            pStmt.executeUpdate();
        } catch (Exception e) {
            TraceEjb.error("Failed to create bean in database", e);
            throw new javax.ejb.CreateException(e.toString());
        } finally {
            if (pStmt != null) {
                try {
                    pStmt.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the PreparedStatement (ejbCreate)", ignore);
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the Connection (ejbCreate)", ignore);
                }
            }
        }
        return(pk);
    }

    public com.hbsrx.ejb.entity.ProductPK ejbFindByPrimaryKey(com.hbsrx.ejb.entity.ProductPK p1)  throws javax.ejb.FinderException {
        TraceEjb.debugGenIC("JOnASProductBeanHome.ejbFindByPrimaryKey(com.hbsrx.ejb.entity.ProductPK)");
        Connection conn = null;
        PreparedStatement pStmt = null;
        try {
            DataSource ds = (DataSource)(this.ejbHome.getDataSource());
            conn = ds.getConnection();
            pStmt = conn.prepareStatement("select prod_num from PRODUCT where prod_num=?");
            pStmt.setLong(1, p1.prodNum);
            ResultSet rs = pStmt.executeQuery();
            if (rs.next() == false) {
                TraceEjb.debugGenIC("Object not found in database (findByPrimaryKey)");
                throw new ObjectNotFoundException("Object not found in database (findByPrimaryKey)");
            }
        } catch (ObjectNotFoundException oe) {
            throw oe;
        } catch (Exception e) {
            TraceEjb.error("Failed to find bean from database (findByPrimaryKey)", e);
            throw new FinderException("Failed to find bean from database (findByPrimaryKey)");
        } finally {
            if (pStmt != null) {
                try {
                    pStmt.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the PreparedStatement (findByPrimaryKey)" ,ignore);
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the Connection (findByPrimaryKey)" ,ignore);
                }
            }
        }
        return(p1);
    }

    public void ejbLoad() {
        TraceEjb.debugGenIC("JOnASProductBeanBean.ejbLoad()");
        Connection conn = null;
        PreparedStatement pStmt = null;
        try {
            com.hbsrx.ejb.entity.ProductPK pk = (com.hbsrx.ejb.entity.ProductPK)(this.ejbContext.getEJBObject().getPrimaryKey());
            DataSource ds = (DataSource)(this.ejbHome.getDataSource());
            conn = ds.getConnection();
            pStmt = conn.prepareStatement("select prod_num, ship_type, prod_type, prod_rx_required, prod_ndc_num, prod_catelog_num, prc_table_num, prod_taxable, mfg_num, theraputic_class, prod_create_date, prod_inactive, prod_inactive_effective_date, prod_last_change_date, prod_units, prod_form_desc, prod_strength, prod_unit_package_item, prod_lot_track_mandatory, prod_last_sale_date, prod_min_qty_dispense, prod_max_qty_dispense, prod_compound, prod_compound_auto_price, prod_compound_print_label, prod_generic, prod_no_gen, prod_narc_code, prod_def_days, prod_def_instructions, prod_def_qty, prod_pa_medicaid_exempt, prod_sig_definition, prod_state_formulary_code, prod_kdc_num, prod_gcn_num, prod_lomn_req, prod_vial_qty, prod_report_code, prod_prior_auth, prod_no_label, prod_auto_update, prod_unit_of_use, prod_no_acq_whl_upd, prod_sex, prod_age, prod_revenue_code, prod_active_prod, prod_theraputic_sub, prod_utilization_prod, pr_code, prod_picked_flier_code, prod_medicare_cover, prod_metric_decimal_qty, prod_gpi, prod_compound_fee, prod_min_age, prod_comment_id, prod_methamphetamine, prod_pkg_qty, prod_hazmat, prod_taxware_category from PRODUCT where prod_num=?");
            pStmt.setLong(1, pk.prodNum);
            ResultSet rs = pStmt.executeQuery();
            if (rs.next() == false) {
                TraceEjb.error("Failed to load bean from database");
                throw new EJBException("Failed to load bean from database");
            }
            this.prodNum = rs.getLong("prod_num");
            this.shipType = (java.lang.Integer)rs.getObject("ship_type");
            if (rs.wasNull()) {
                this.shipType = null;
            }
            this.prodType = rs.getInt("prod_type");
            this.prodRxRequired = rs.getString("prod_rx_required");
            this.prodNdcNum = (java.lang.Long)rs.getObject("prod_ndc_num");
            if (rs.wasNull()) {
                this.prodNdcNum = null;
            }
            this.prodCatelogNum = rs.getString("prod_catelog_num");
            this.prcTableNum = (java.lang.Long)rs.getObject("prc_table_num");
            if (rs.wasNull()) {
                this.prcTableNum = null;
            }
            this.prodTaxable = rs.getString("prod_taxable");
            this.mfgNum = (java.lang.Integer)rs.getObject("mfg_num");
            if (rs.wasNull()) {
                this.mfgNum = null;
            }
            this.theraputicClass = (java.lang.Integer)rs.getObject("theraputic_class");
            if (rs.wasNull()) {
                this.theraputicClass = null;
            }
            this.prodCreateDate = rs.getTimestamp("prod_create_date");
            this.prodInactive = rs.getString("prod_inactive");
            this.prodInactiveEffectiveDate = rs.getTimestamp("prod_inactive_effective_date");
            this.prodLastChangeDate = rs.getTimestamp("prod_last_change_date");
            this.prodUnits = (java.lang.Integer)rs.getObject("prod_units");
            if (rs.wasNull()) {
                this.prodUnits = null;
            }
            this.prodFormDesc = rs.getString("prod_form_desc");
            this.prodStrength = (java.lang.Long)rs.getObject("prod_strength");
            if (rs.wasNull()) {
                this.prodStrength = null;
            }
            this.prodUnitPackageItem = rs.getString("prod_unit_package_item");
            this.prodLotTrackMandatory = rs.getString("prod_lot_track_mandatory");
            this.prodLastSaleDate = rs.getTimestamp("prod_last_sale_date");
            this.prodMinQtyDispense = (java.lang.Long)rs.getObject("prod_min_qty_dispense");
            if (rs.wasNull()) {
                this.prodMinQtyDispense = null;
            }
            this.prodMaxQtyDispense = (java.lang.Long)rs.getObject("prod_max_qty_dispense");
            if (rs.wasNull()) {
                this.prodMaxQtyDispense = null;
            }
            this.prodCompound = rs.getString("prod_compound");
            this.prodCompoundAutoPrice = rs.getString("prod_compound_auto_price");
            this.prodCompoundPrintLabel = rs.getString("prod_compound_print_label");
            this.prodGeneric = rs.getString("prod_generic");
            this.prodNoGen = rs.getString("prod_no_gen");
            this.prodNarcCode = (java.lang.Integer)rs.getObject("prod_narc_code");
            if (rs.wasNull()) {
                this.prodNarcCode = null;
            }
            this.prodDefDays = (java.lang.Integer)rs.getObject("prod_def_days");
            if (rs.wasNull()) {
                this.prodDefDays = null;
            }
            this.prodDefInstructions = rs.getString("prod_def_instructions");
            this.prodDefQty = (java.lang.Integer)rs.getObject("prod_def_qty");
            if (rs.wasNull()) {
                this.prodDefQty = null;
            }
            this.prodPaMedicaidExempt = rs.getString("prod_pa_medicaid_exempt");
            this.prodSigDefinition = rs.getString("prod_sig_definition");
            this.prodStateFormularyCode = rs.getString("prod_state_formulary_code");
            this.prodKdcNum = (java.lang.Integer)rs.getObject("prod_kdc_num");
            if (rs.wasNull()) {
                this.prodKdcNum = null;
            }
            this.prodGcnNum = rs.getString("prod_gcn_num");
            this.prodLomnReq = rs.getString("prod_lomn_req");
            this.prodVialQty = (java.lang.Integer)rs.getObject("prod_vial_qty");
            if (rs.wasNull()) {
                this.prodVialQty = null;
            }
            this.prodReportCode = rs.getString("prod_report_code");
            this.prodPriorAuth = rs.getString("prod_prior_auth");
            this.prodNoLabel = rs.getString("prod_no_label");
            this.prodAutoUpdate = rs.getString("prod_auto_update");
            this.prodUnitOfUse = (java.lang.Integer)rs.getObject("prod_unit_of_use");
            if (rs.wasNull()) {
                this.prodUnitOfUse = null;
            }
            this.prodNoAcqWhlUpd = rs.getString("prod_no_acq_whl_upd");
            this.prodSex = rs.getString("prod_sex");
            this.prodAge = (java.lang.Integer)rs.getObject("prod_age");
            if (rs.wasNull()) {
                this.prodAge = null;
            }
            this.prodRevenueCode = (java.lang.Integer)rs.getObject("prod_revenue_code");
            if (rs.wasNull()) {
                this.prodRevenueCode = null;
            }
            this.prodActiveProd = (java.lang.Long)rs.getObject("prod_active_prod");
            if (rs.wasNull()) {
                this.prodActiveProd = null;
            }
            this.prodTheraputicSub = (java.lang.Long)rs.getObject("prod_theraputic_sub");
            if (rs.wasNull()) {
                this.prodTheraputicSub = null;
            }
            this.prodUtilizationProd = (java.lang.Long)rs.getObject("prod_utilization_prod");
            if (rs.wasNull()) {
                this.prodUtilizationProd = null;
            }
            this.prCode = rs.getString("pr_code");
            this.prodPickedFlierCode = (java.lang.Integer)rs.getObject("prod_picked_flier_code");
            if (rs.wasNull()) {
                this.prodPickedFlierCode = null;
            }
            this.prodMedicareCover = rs.getString("prod_medicare_cover");
            this.prodMetricDecimalQty = (java.lang.Integer)rs.getObject("prod_metric_decimal_qty");
            if (rs.wasNull()) {
                this.prodMetricDecimalQty = null;
            }
            this.prodGpi = (java.lang.Long)rs.getObject("prod_gpi");
            if (rs.wasNull()) {
                this.prodGpi = null;
            }
            this.prodCompoundFee = (java.lang.Long)rs.getObject("prod_compound_fee");
            if (rs.wasNull()) {
                this.prodCompoundFee = null;
            }
            this.prodMinAge = (java.lang.Integer)rs.getObject("prod_min_age");
            if (rs.wasNull()) {
                this.prodMinAge = null;
            }
            this.prodCommentId = (java.lang.Long)rs.getObject("prod_comment_id");
            if (rs.wasNull()) {
                this.prodCommentId = null;
            }
            this.prodMethamphetamine = rs.getString("prod_methamphetamine");
            this.prodPkgQty = (java.lang.Integer)rs.getObject("prod_pkg_qty");
            if (rs.wasNull()) {
                this.prodPkgQty = null;
            }
            this.prodHazmat = rs.getString("prod_hazmat");
            this.prodTaxwareCategory = rs.getString("prod_taxware_category");
        } catch (Exception e) {
            TraceEjb.error("Failed to load bean from database", e);
            throw new EJBException(e);
        } finally {
            if (pStmt != null) {
                try {
                    pStmt.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the PreparedStatement (ejbLoad)", ignore);
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the Connection (ejbLoad)", ignore);
                }
            }
        }
        super.ejbLoad();
    }

    public void ejbStore() {
        TraceEjb.debugGenIC("JOnASProductBeanBean.ejbStore()");
        if (this.isModifiedData()) {
            super.ejbStore();
            Connection conn = null;
            PreparedStatement pStmt = null;
            try {
                com.hbsrx.ejb.entity.ProductPK pk = (com.hbsrx.ejb.entity.ProductPK)(this.ejbContext.getEJBObject().getPrimaryKey());
                DataSource ds = (DataSource)(this.ejbHome.getDataSource());
                conn = ds.getConnection();
                pStmt = conn.prepareStatement("update PRODUCT set ship_type=?, prod_type=?, prod_rx_required=?, prod_ndc_num=?, prod_catelog_num=?, prc_table_num=?, prod_taxable=?, mfg_num=?, theraputic_class=?, prod_create_date=?, prod_inactive=?, prod_inactive_effective_date=?, prod_last_change_date=?, prod_units=?, prod_form_desc=?, prod_strength=?, prod_unit_package_item=?, prod_lot_track_mandatory=?, prod_last_sale_date=?, prod_min_qty_dispense=?, prod_max_qty_dispense=?, prod_compound=?, prod_compound_auto_price=?, prod_compound_print_label=?, prod_generic=?, prod_no_gen=?, prod_narc_code=?, prod_def_days=?, prod_def_instructions=?, prod_def_qty=?, prod_pa_medicaid_exempt=?, prod_sig_definition=?, prod_state_formulary_code=?, prod_kdc_num=?, prod_gcn_num=?, prod_lomn_req=?, prod_vial_qty=?, prod_report_code=?, prod_prior_auth=?, prod_no_label=?, prod_auto_update=?, prod_unit_of_use=?, prod_no_acq_whl_upd=?, prod_sex=?, prod_age=?, prod_revenue_code=?, prod_active_prod=?, prod_theraputic_sub=?, prod_utilization_prod=?, pr_code=?, prod_picked_flier_code=?, prod_medicare_cover=?, prod_metric_decimal_qty=?, prod_gpi=?, prod_compound_fee=?, prod_min_age=?, prod_comment_id=?, prod_methamphetamine=?, prod_pkg_qty=?, prod_hazmat=?, prod_taxware_category=? where prod_num=?");
                if (this.shipType == null) {
                    pStmt.setNull(1, Types.INTEGER);
                } else {
                    pStmt.setObject(1, (java.lang.Object)this.shipType);
                }
                pStmt.setInt(2, this.prodType);
                if (this.prodRxRequired == null) {
                    pStmt.setNull(3, Types.VARCHAR);
                } else {
                    pStmt.setString(3, this.prodRxRequired);
                }
                if (this.prodNdcNum == null) {
                    pStmt.setNull(4, Types.BIGINT);
                } else {
                    pStmt.setObject(4, (java.lang.Object)this.prodNdcNum);
                }
                if (this.prodCatelogNum == null) {
                    pStmt.setNull(5, Types.VARCHAR);
                } else {
                    pStmt.setString(5, this.prodCatelogNum);
                }
                if (this.prcTableNum == null) {
                    pStmt.setNull(6, Types.BIGINT);
                } else {
                    pStmt.setObject(6, (java.lang.Object)this.prcTableNum);
                }
                if (this.prodTaxable == null) {
                    pStmt.setNull(7, Types.VARCHAR);
                } else {
                    pStmt.setString(7, this.prodTaxable);
                }
                if (this.mfgNum == null) {
                    pStmt.setNull(8, Types.INTEGER);
                } else {
                    pStmt.setObject(8, (java.lang.Object)this.mfgNum);
                }
                if (this.theraputicClass == null) {
                    pStmt.setNull(9, Types.INTEGER);
                } else {
                    pStmt.setObject(9, (java.lang.Object)this.theraputicClass);
                }
                if (this.prodCreateDate == null) {
                    pStmt.setNull(10, Types.TIMESTAMP);
                } else {
                    pStmt.setTimestamp(10, this.prodCreateDate);
                }
                if (this.prodInactive == null) {
                    pStmt.setNull(11, Types.VARCHAR);
                } else {
                    pStmt.setString(11, this.prodInactive);
                }
                if (this.prodInactiveEffectiveDate == null) {
                    pStmt.setNull(12, Types.TIMESTAMP);
                } else {
                    pStmt.setTimestamp(12, this.prodInactiveEffectiveDate);
                }
                if (this.prodLastChangeDate == null) {
                    pStmt.setNull(13, Types.TIMESTAMP);
                } else {
                    pStmt.setTimestamp(13, this.prodLastChangeDate);
                }
                if (this.prodUnits == null) {
                    pStmt.setNull(14, Types.INTEGER);
                } else {
                    pStmt.setObject(14, (java.lang.Object)this.prodUnits);
                }
                if (this.prodFormDesc == null) {
                    pStmt.setNull(15, Types.VARCHAR);
                } else {
                    pStmt.setString(15, this.prodFormDesc);
                }
                if (this.prodStrength == null) {
                    pStmt.setNull(16, Types.BIGINT);
                } else {
                    pStmt.setObject(16, (java.lang.Object)this.prodStrength);
                }
                if (this.prodUnitPackageItem == null) {
                    pStmt.setNull(17, Types.VARCHAR);
                } else {
                    pStmt.setString(17, this.prodUnitPackageItem);
                }
                if (this.prodLotTrackMandatory == null) {
                    pStmt.setNull(18, Types.VARCHAR);
                } else {
                    pStmt.setString(18, this.prodLotTrackMandatory);
                }
                if (this.prodLastSaleDate == null) {
                    pStmt.setNull(19, Types.TIMESTAMP);
                } else {
                    pStmt.setTimestamp(19, this.prodLastSaleDate);
                }
                if (this.prodMinQtyDispense == null) {
                    pStmt.setNull(20, Types.BIGINT);
                } else {
                    pStmt.setObject(20, (java.lang.Object)this.prodMinQtyDispense);
                }
                if (this.prodMaxQtyDispense == null) {
                    pStmt.setNull(21, Types.BIGINT);
                } else {
                    pStmt.setObject(21, (java.lang.Object)this.prodMaxQtyDispense);
                }
                if (this.prodCompound == null) {
                    pStmt.setNull(22, Types.VARCHAR);
                } else {
                    pStmt.setString(22, this.prodCompound);
                }
                if (this.prodCompoundAutoPrice == null) {
                    pStmt.setNull(23, Types.VARCHAR);
                } else {
                    pStmt.setString(23, this.prodCompoundAutoPrice);
                }
                if (this.prodCompoundPrintLabel == null) {
                    pStmt.setNull(24, Types.VARCHAR);
                } else {
                    pStmt.setString(24, this.prodCompoundPrintLabel);
                }
                if (this.prodGeneric == null) {
                    pStmt.setNull(25, Types.VARCHAR);
                } else {
                    pStmt.setString(25, this.prodGeneric);
                }
                if (this.prodNoGen == null) {
                    pStmt.setNull(26, Types.VARCHAR);
                } else {
                    pStmt.setString(26, this.prodNoGen);
                }
                if (this.prodNarcCode == null) {
                    pStmt.setNull(27, Types.INTEGER);
                } else {
                    pStmt.setObject(27, (java.lang.Object)this.prodNarcCode);
                }
                if (this.prodDefDays == null) {
                    pStmt.setNull(28, Types.INTEGER);
                } else {
                    pStmt.setObject(28, (java.lang.Object)this.prodDefDays);
                }
                if (this.prodDefInstructions == null) {
                    pStmt.setNull(29, Types.VARCHAR);
                } else {
                    pStmt.setString(29, this.prodDefInstructions);
                }
                if (this.prodDefQty == null) {
                    pStmt.setNull(30, Types.INTEGER);
                } else {
                    pStmt.setObject(30, (java.lang.Object)this.prodDefQty);
                }
                if (this.prodPaMedicaidExempt == null) {
                    pStmt.setNull(31, Types.VARCHAR);
                } else {
                    pStmt.setString(31, this.prodPaMedicaidExempt);
                }
                if (this.prodSigDefinition == null) {
                    pStmt.setNull(32, Types.VARCHAR);
                } else {
                    pStmt.setString(32, this.prodSigDefinition);
                }
                if (this.prodStateFormularyCode == null) {
                    pStmt.setNull(33, Types.VARCHAR);
                } else {
                    pStmt.setString(33, this.prodStateFormularyCode);
                }
                if (this.prodKdcNum == null) {
                    pStmt.setNull(34, Types.INTEGER);
                } else {
                    pStmt.setObject(34, (java.lang.Object)this.prodKdcNum);
                }
                if (this.prodGcnNum == null) {
                    pStmt.setNull(35, Types.VARCHAR);
                } else {
                    pStmt.setString(35, this.prodGcnNum);
                }
                if (this.prodLomnReq == null) {
                    pStmt.setNull(36, Types.VARCHAR);
                } else {
                    pStmt.setString(36, this.prodLomnReq);
                }
                if (this.prodVialQty == null) {
                    pStmt.setNull(37, Types.INTEGER);
                } else {
                    pStmt.setObject(37, (java.lang.Object)this.prodVialQty);
                }
                if (this.prodReportCode == null) {
                    pStmt.setNull(38, Types.VARCHAR);
                } else {
                    pStmt.setString(38, this.prodReportCode);
                }
                if (this.prodPriorAuth == null) {
                    pStmt.setNull(39, Types.VARCHAR);
                } else {
                    pStmt.setString(39, this.prodPriorAuth);
                }
                if (this.prodNoLabel == null) {
                    pStmt.setNull(40, Types.VARCHAR);
                } else {
                    pStmt.setString(40, this.prodNoLabel);
                }
                if (this.prodAutoUpdate == null) {
                    pStmt.setNull(41, Types.VARCHAR);
                } else {
                    pStmt.setString(41, this.prodAutoUpdate);
                }
                if (this.prodUnitOfUse == null) {
                    pStmt.setNull(42, Types.INTEGER);
                } else {
                    pStmt.setObject(42, (java.lang.Object)this.prodUnitOfUse);
                }
                if (this.prodNoAcqWhlUpd == null) {
                    pStmt.setNull(43, Types.VARCHAR);
                } else {
                    pStmt.setString(43, this.prodNoAcqWhlUpd);
                }
                if (this.prodSex == null) {
                    pStmt.setNull(44, Types.VARCHAR);
                } else {
                    pStmt.setString(44, this.prodSex);
                }
                if (this.prodAge == null) {
                    pStmt.setNull(45, Types.INTEGER);
                } else {
                    pStmt.setObject(45, (java.lang.Object)this.prodAge);
                }
                if (this.prodRevenueCode == null) {
                    pStmt.setNull(46, Types.INTEGER);
                } else {
                    pStmt.setObject(46, (java.lang.Object)this.prodRevenueCode);
                }
                if (this.prodActiveProd == null) {
                    pStmt.setNull(47, Types.BIGINT);
                } else {
                    pStmt.setObject(47, (java.lang.Object)this.prodActiveProd);
                }
                if (this.prodTheraputicSub == null) {
                    pStmt.setNull(48, Types.BIGINT);
                } else {
                    pStmt.setObject(48, (java.lang.Object)this.prodTheraputicSub);
                }
                if (this.prodUtilizationProd == null) {
                    pStmt.setNull(49, Types.BIGINT);
                } else {
                    pStmt.setObject(49, (java.lang.Object)this.prodUtilizationProd);
                }
                if (this.prCode == null) {
                    pStmt.setNull(50, Types.VARCHAR);
                } else {
                    pStmt.setString(50, this.prCode);
                }
                if (this.prodPickedFlierCode == null) {
                    pStmt.setNull(51, Types.INTEGER);
                } else {
                    pStmt.setObject(51, (java.lang.Object)this.prodPickedFlierCode);
                }
                if (this.prodMedicareCover == null) {
                    pStmt.setNull(52, Types.VARCHAR);
                } else {
                    pStmt.setString(52, this.prodMedicareCover);
                }
                if (this.prodMetricDecimalQty == null) {
                    pStmt.setNull(53, Types.INTEGER);
                } else {
                    pStmt.setObject(53, (java.lang.Object)this.prodMetricDecimalQty);
                }
                if (this.prodGpi == null) {
                    pStmt.setNull(54, Types.BIGINT);
                } else {
                    pStmt.setObject(54, (java.lang.Object)this.prodGpi);
                }
                if (this.prodCompoundFee == null) {
                    pStmt.setNull(55, Types.BIGINT);
                } else {
                    pStmt.setObject(55, (java.lang.Object)this.prodCompoundFee);
                }
                if (this.prodMinAge == null) {
                    pStmt.setNull(56, Types.INTEGER);
                } else {
                    pStmt.setObject(56, (java.lang.Object)this.prodMinAge);
                }
                if (this.prodCommentId == null) {
                    pStmt.setNull(57, Types.BIGINT);
                } else {
                    pStmt.setObject(57, (java.lang.Object)this.prodCommentId);
                }
                if (this.prodMethamphetamine == null) {
                    pStmt.setNull(58, Types.VARCHAR);
                } else {
                    pStmt.setString(58, this.prodMethamphetamine);
                }
                if (this.prodPkgQty == null) {
                    pStmt.setNull(59, Types.INTEGER);
                } else {
                    pStmt.setObject(59, (java.lang.Object)this.prodPkgQty);
                }
                if (this.prodHazmat == null) {
                    pStmt.setNull(60, Types.VARCHAR);
                } else {
                    pStmt.setString(60, this.prodHazmat);
                }
                if (this.prodTaxwareCategory == null) {
                    pStmt.setNull(61, Types.VARCHAR);
                } else {
                    pStmt.setString(61, this.prodTaxwareCategory);
                }
                pStmt.setLong(62, pk.prodNum);
                pStmt.executeUpdate();
            } catch (Exception e) {
                TraceEjb.verbose("Failed to store bean to database:"+e);
                throw new EJBException(e);
            } finally {
                if (pStmt != null) {
                    try {
                        pStmt.close();
                    } catch (Exception ignore) {
                        TraceEjb.error("Failed to close the PreparedStatement (StoreData)",ignore);
                    }
                }
                if (conn != null) {
                    try {
                        conn.close();
                    } catch (Exception ignore) {
                        TraceEjb.error("Failed to close the Connection (StoreData)",ignore);
                    }
                }
            }
        }
    }

    public void ejbRemove() {
        TraceEjb.debugGenIC("JOnASProductBeanBean.ejbRemove()");
        super.ejbRemove();
        Connection conn = null;
        PreparedStatement pStmt = null;
        try {
            com.hbsrx.ejb.entity.ProductPK pk = (com.hbsrx.ejb.entity.ProductPK)(this.ejbContext.getEJBObject().getPrimaryKey());
            DataSource ds = (DataSource)(this.ejbHome.getDataSource());
            conn = ds.getConnection();
            pStmt = conn.prepareStatement("delete from PRODUCT where prod_num=?");
            pStmt.setLong(1, pk.prodNum);
            pStmt.executeUpdate();
        } catch (Exception e) {
            TraceEjb.error("Failed to delete bean from database", e);
            throw new javax.ejb.RemoveException(e.toString());
        } finally {
            if (pStmt != null) {
                try {
                    pStmt.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the PreparedStatement (RemoveData)", ignore);
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (Exception ignore) {
                    TraceEjb.error("Failed to close the Connection (RemoveData)", ignore);
                }
            }
        }
    }

}

