These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Getting the list of object without using relations
PostPosted: Thu Sep 17, 2009 8:26 pm 
Newbie

Joined: Wed Sep 16, 2009 1:24 am
Posts: 9
I have two tables
1. LoanCustomerDetail - having relation with LoanDetail table
2. CustomerObject - temporary table

I need to get list of LoanCustomerDetail objects ,based on the customerNo's from the CustomerObject,which has no relation with LoanCustomerDetail object.

For this I need to write a HQL to list all loanCustomerDetail object,
Is it possible to use HQL for this criteria or do we have to go with SQL ?

Code:

/**
* @hibernate.class table="LOAN_CUST_DETAIL"
*/
public class LoanCustomerDetail {

   
   public Long loanCustId;
   
   public String customerNo;
   
   public String loanId;
   
   
   
   /**
     * @hibernate.property column="CUST_NUM"
    * @return Returns the customerNo.
    */
   public String getCustomerNo() {
      return customerNo;
   }
   /**
    * @param customerNo The customerNo to set.
    */
   public void setCustomerNo(String customerNo) {
      this.customerNo = customerNo;
   }
   /**
    * @hibernate.id generator-class="native" column="LOAN_CUST_ID"
    * @return Returns the loanCustId.
    */
   public Long getLoanCustId() {
      return loanCustId;
   }
   /**
    * @param loanCustId The loanCustId to set.
    */
   public void setLoanCustId(Long loanCustId) {
      this.loanCustId = loanCustId;
   }
   /**
    * @hibernate.property column="LOAN_ID"
    * @return Returns the loanId.
    */
   public String getLoanId() {
      return loanId;
   }
   /**
    * @param loanId The loanId to set.
    */
   public void setLoanId(String loanId) {
      this.loanId = loanId;
   }
}

Code:
/**
*
* @hibernate.class table="CUST_OBJ"
*/
public class CustomerObject {
   
   public Long customerId;
   
   public String customerNo;
   
   public String customerName;
   

   /**
    * @hibernate.id generator-class="native" column="CUST_ID"
    * @return Returns the customerId.
    */
   public Long getCustomerId() {
      return customerId;
   }
   /**
    * @param customerId The customerId to set.
    */
   public void setCustomerId(Long customerId) {
      this.customerId = customerId;
   }
   /**
    * @hibernate.property column="CUST_NAME"
    * @return Returns the customerName.
    */
   public String getCustomerName() {
      return customerName;
   }
   /**
    * @param customerName The customerName to set.
    */
   public void setCustomerName(String customerName) {
      this.customerName = customerName;
   }
   /**
    * @hibernate.property column="CUST_NUM"
    * @return Returns the customerNo.
    */
   public String getCustomerNo() {
      return customerNo;
   }
   /**
    * @param customerNo The customerNo to set.
    */
   public void setCustomerNo(String customerNo) {
      this.customerNo = customerNo;
   }
}


Thanks in advance


Top
 Profile  
 
 Post subject: Re: Getting the list of object without using relations
PostPosted: Sun Sep 20, 2009 3:04 pm 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
such a scenario normal SQL is better. Try with that.

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.