Ask Experts Questions for FREE Help !
Ask
    aifra21's Avatar
    aifra21 Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 20, 2013, 01:46 PM
    Having trouble with DaoImplementation class Java
    Hi, I have a DaoHibernateImpl class. I am getting error when I am running my webapplication and the error is this class. Here is the code for OfferBankDaoHibernateImpl.java
    Code:
    package com.safeway.app.emom.dao.hibernate;
    
    ...
    public class OfferBankDaoHibernateImpl extends GenericDaoHibernateImpl<OfferBank, Long> implements OfferBankDao {
    
    	static Logger log = Logger.getLogger(OfferBankDaoHibernateImpl.class);
    	private ResourceManager rMgr = new ResourceManager(this);
    
    	public List<OfferBank> findOfferBankByName(String offerBankNm) throws AppException {
    		List<OfferBank> offerBanks = new ArrayList<OfferBank>();
    		try {
    			// offerBanks =
    			// sessionFactory.getCurrentSession().createCriteria(OfferBank.class)
    			// .add( Restrictions.eq("offerBankNm", offerBankNm))
    			// .list();
    
    			offerBanks = sessionFactory.getCurrentSession().createQuery("from OfferBank ob where ob.offerBankNm = '" + offerBankNm + "'").list();
    		} catch (GenericJDBCException e) {
    			log.error(e.getMessage(), e);
    			throw new AppException(e.getMessage(), e);
    		} catch (HibernateException e) {
    			log.error(e.getMessage(), e);
    			throw new AppException(e.getMessage(), e);
    		}
    		return offerBanks;
    	}
    
    	public Object[] getOfferBanks(List<String> offerBankTypes, int startPos, int endPos, List<Long> statusIds) {
    		int totalRowCount = 1000000;
    		try {
    			if (endPos == 0) {
    				endPos = totalRowCount;
    			}
    			String dataSql = rMgr.get("sql.offer_bank_get_banks");
    			dataSql += " " + rMgr.get("sql.offer_bank_get_banks_types_where");
    			if (!statusIds.isEmpty()) {
    				dataSql += " " + rMgr.get("sql.offer_bank_get_banks_status_where");
    			}
    			dataSql += " " + rMgr.get("sql.offer_banks_get_banks_group_by");
    
    			log.debug("query : " + dataSql);
    			SQLQuery dataQuery = this.sessionFactory.getCurrentSession().createSQLQuery(dataSql);
    			if (!statusIds.isEmpty()) {
    				dataQuery.setParameterList("offerBankStatusIds", statusIds);
    			}
    			dataQuery.setParameterList("offerBankTypes", offerBankTypes).setParameter("start", startPos).setParameter("end", endPos);
    			List offerBankList = dataQuery.list();
    			return makeOfferBankTO(offerBankList);
    		} catch (RuntimeException e) {
    			log.error("Error getOfferBanks(List<Long> offerBankTypes ,int startPos, int endPos, List<Long> statusIds)...");
    			throw e;
    		}
    	}
    
    	public Object[] getOfferBanksByRegion(List<String> offerBankTypes, int startPos, int endPos, List<Long> statusIds) {
    		int totalRowCount = 1000000;
    		try {
    			if (endPos == 0) {
    				endPos = totalRowCount;
    			}
    			String dataSql = rMgr.get("sql.offer_bank_get_banks_by_region");
    			dataSql += " " + rMgr.get("sql.offer_bank_get_banks_types_where");
    			if (!statusIds.isEmpty()) {
    				dataSql += " " + rMgr.get("sql.offer_bank_get_banks_status_where");
    			}
    			dataSql += " " + rMgr.get("sql.offer_banks_get_banks_by_region_group_by");
    
    			log.debug("query : " + dataSql);
    			SQLQuery dataQuery = this.sessionFactory.getCurrentSession().createSQLQuery(dataSql);
    			if (!statusIds.isEmpty()) {
    				dataQuery.setParameterList("offerBankStatusIds", statusIds);
    			}
    			dataQuery.setParameterList("offerBankTypes", offerBankTypes).setParameter("start", startPos).setParameter("end", endPos);
    			List offerBankList = dataQuery.list();
    			return makeOfferBankTO(offerBankList);
    		} catch (RuntimeException e) {
    			log.error("Error getOfferBanksByRegion(List<Long> offerBankTypes ,int startPos, int endPos, List<Long> statusIds)");
    			throw e;
    		}
    	}
    
    	public Object[] getOfferBanksByBanner(List<String> offerBankTypes, int startPos, int endPos, List<Long> statusIds) {
    		int totalRowCount = 1000000;
    		try {
    			if (endPos == 0) {
    				endPos = totalRowCount;
    			}
    			String dataSql = rMgr.get("sql.offer_bank_get_banks_by_banner");
    			dataSql += " " + rMgr.get("sql.offer_bank_get_banks_types_where");
    			if (!statusIds.isEmpty()) {
    				dataSql += " " + rMgr.get("sql.offer_bank_get_banks_status_where");
    			}
    			dataSql += " " + rMgr.get("sql.offer_banks_get_banks_by_banner_group_by");
    
    			log.debug("query : " + dataSql);
    			SQLQuery dataQuery = this.sessionFactory.getCurrentSession().createSQLQuery(dataSql);
    			if (!statusIds.isEmpty()) {
    				dataQuery.setParameterList("offerBankStatusIds", statusIds);
    			}
    			dataQuery.setParameterList("offerBankTypes", offerBankTypes).setParameter("start", startPos).setParameter("end", endPos);
    			List offerBankList = dataQuery.list();
    			return makeOfferBankTO(offerBankList);
    		} catch (RuntimeException e) {
    			log.error("Error getOfferBanksByBanner(List<Long> offerBankTypes ,int startPos, int endPos, List<Long> statusIds)");
    			throw e;
    		}
    	}
    
    	public Object[] getOfferBankById(List<Long> offerBankIds) {
    		int startPos = 1;
    		int endPos = 100000;
    		String dataSql = rMgr.get("sql.offer_bank_get_banks");
    		dataSql += " " + rMgr.get("sql.offer_bank_get_banks_ids_where");
    		dataSql += " " + rMgr.get("sql.offer_banks_get_banks_group_by");
    		log.debug("sql= " + dataSql);
    		SQLQuery dataQuery = this.sessionFactory.getCurrentSession().createSQLQuery(dataSql);
    		dataQuery.setParameterList("offerBankIds", offerBankIds).setParameter("start", startPos).setParameter("end", endPos);
    		List offerBankList = dataQuery.list();
    		return makeOfferBankTO(offerBankList);
    	}
    
    	.....
    
    
    	}
    
    
    }
    It has xml file as:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <properties>	
    	<sql>
    		<database>emom</database>
    		<database env="DV">emom</database>
    		<database env="QA">emom</database>
    		<database env="PR">emom</database>
    		<offer_bank_get_banks>
    			select * from (
    				select 
    		            ob.offer_bank_id
    				    , ob.promo_period_id
    				    , ob.offer_bank_nm
    				    , obst.offer_bank_status_type_dsc
    				    , ob.effective_start_dt
    		            , ob.effective_end_dt
    		            , obt.offer_bank_type_dsc
    		            , obt.offer_bank_type_cd
    		            , pp.promo_period_nm
    		            , SUM(CASE WHEN a.offer_id IS NOT NULL THEN 1 ELSE 0 END) as total_count
    				    , SUM(CASE WHEN a.offer_status_type_cd = 'ED' THEN 1 ELSE 0 END) as editing_count
    				    , SUM(CASE WHEN a.offer_status_type_cd = 'FD' THEN 1 ELSE 0 END) as failed_deactive_count
    				    , SUM(CASE WHEN a.offer_status_type_cd in ('FP', 'FI') THEN 1 ELSE 0 END) as failed_production_count
    				    , SUM(CASE WHEN a.offer_status_type_cd = 'FV' THEN 1 ELSE 0 END) as failed_preview_count
    				    , SUM(CASE WHEN a.offer_status_type_cd = 'LD' THEN 1 ELSE 0 END) as loaded_count			     
    				    , SUM(CASE WHEN a.offer_status_type_cd in ('PE', 'PS') THEN 1 ELSE 0 END) as pending_count
    		            , SUM(CASE WHEN a.offer_status_type_cd = 'PK' THEN 1 ELSE 0 END) as parked_count
    		            , SUM(CASE WHEN a.offer_status_type_cd = 'SD' THEN 1 ELSE 0 END) as successfully_deactivated_coun
    		            , SUM(CASE WHEN a.offer_status_type_cd in ('SP','PI') THEN 1 ELSE 0 END) as successfully_loaded_to_prod_co
    		            , SUM(CASE WHEN a.offer_status_type_cd = 'SV' THEN 1 ELSE 0 END) as successfully_loaded_to_preview	            
    		            , SUM(CASE WHEN a.offer_status_type_cd in ('LD','PE','PS') THEN 1 ELSE 0 END) as total_pending_count        
    		            , SUM(CASE WHEN a.offer_status_type_cd in ('FD','FP','FV','FR','FI') THEN 1 ELSE 0 END) as failed_count
    		            , COUNT(1) OVER(PARTITION BY 1) as total_rows
    		            , ROW_NUMBER() OVER (ORDER BY ob.effective_end_dt desc) as row_nbr	 
    		            , MAX(a.offer_effective_end_dt)as max_offer_effective_end_dt
    		            , MIN(a.offer_effective_start_dt)as min_offer_effective_start_dt
    		            , SUM(CASE WHEN a.offer_status_type_cd in('AR','SR','SD') THEN 1 ELSE 0 END) as ended_count  
    		            , SUM(CASE WHEN a.offer_status_type_cd in('CD') THEN 1 ELSE 0 END) as copient_delay_count
    		            , SUM(CASE WHEN a.offer_status_type_cd in('SR') THEN 1 ELSE 0 END) as rejected_count
    		            , SUM(CASE WHEN a.offer_status_type_cd in('LV', 'GV', 'CD', 'GA', 'GC', 'GD', 'GI', 'GP', 'GR', 'LA', 'LI', 'LP', 'LR', 'LV', 'LE')
    		            	THEN 1 ELSE 0 END) as processing_count
    				from 
    				    ${sql.database}.offer_bank ob
    		            INNER JOIN ${sql.database}.offer_bank_status obs
    		            ON ob.offer_bank_id = obs.offer_bank_id
    		            INNER JOIN ${sql.database}.offer_bank_status_type obst
    		            ON obs.offer_bank_status_type_cd = obst.offer_bank_status_type_cd
    		            INNER JOIN ${sql.database}.promo_period pp
    		            ON ob.promo_period_id = pp.promo_period_id
    		            INNER JOIN ${sql.database}.offer_bank_type obt
    		            ON ob.offer_bank_type_cd = obt.offer_bank_type_cd	            
    				    LEFT OUTER JOIN 
    	                    (Select 
    	                        o.offer_id
    	                        , o.offer_bank_id
    	                        , ost.offer_status_type_cd
    	                        , o.offer_effective_end_dt
    	                        , o.offer_effective_start_dt
    	                     from 
    	                        ${sql.database}.offer o                        
    	                        INNER JOIN ${sql.database}.offer_status os
    	                        ON o.offer_id = os.offer_id
    	                        INNER JOIN ${sql.database}.offer_status_type ost
    	                        ON os.offer_status_type_cd = ost.offer_status_type_cd
    	                        AND os.effective_end_dt is null
    	                    ) a
    	                ON ob.offer_bank_id = a.offer_bank_id
    				where
    				    obs.effective_end_dt is null	 
    	     </offer_bank_get_banks>
         
         
         ...
    	 	
    	     <offer_banks_get_banks_group_by>
    			     group by
    						    		      ob.offer_bank_id
    				    , ob.promo_period_id
    				    , ob.offer_bank_nm
    				    , obst.offer_bank_status_type_dsc
    				    , ob.effective_start_dt
    		            , ob.effective_end_dt
    		            , obt.offer_bank_type_dsc
    		            , obt.offer_bank_type_cd
    		            , pp.promo_period_nm
                  		  
    						order by
    						    ob.effective_end_dt desc
    					) a
    						where
    						    a.row_nbr between :start and :end
    	     </offer_banks_get_banks_group_by>
    		
    	</sql>
    </properties>
    And the error stack is:

    20:31:27,783 ERROR OfferBankDaoHibernateImpl:76 - Error getOfferBanks(List<Long> offerBankTypes ,int startPos, int endPos, List<Long> statusIds)...

    Any help on this code solution is really appreciated.

    Thanks in advance

Check out some similar questions!

Class boundaries,class width,class mid-point [ 0 Answers ]

Find the class width of the following, 3-7 8-10 11-15 16-18 19-25.

Error: Java Virtual Machine Launcher "Could not find the main class program will exit [ 3 Answers ]

Dear Sir / Madam, When I am trying to open .exj extension file, I am getting error as mentioned above. Please help me, whether I have to install any java module or something other has to be done. Thanks

Decompling java .class [ 2 Answers ]

How can I get a .java file from .class file? Is it possible?

Java Virtual Machine Launcher - Could not find the main class [ 1 Answers ]

When I run a executable file, I am gettibg a error message. ' Java Virtual Machine Launcher ' - Could not find the main class.Program will exit. Can any provide me the solution what the problem maybe? Orelse should I install any software to rectify it?


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.