Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3999504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:39:57+00:00 2026-05-20T07:39:57+00:00

CREATE TABLE ratecodes ( roomId int(11) NOT NULL DEFAULT ‘0’, date date NOT NULL

  • 0

CREATE TABLE ratecodes (
roomId int(11) NOT NULL DEFAULT ‘0’,
date date NOT NULL DEFAULT ‘0000-00-00’,
…, PRIMARY KEY (roomId,date))
hbm.xml

<class catalog="hermes" name="com.hermes.data.RateCode" table="ratecodes">
<composite-id class="com.hermes.data.RateCodeId" name="id">
      <key-property name="roomId" type="int">
        <column name="roomId"/>
      </key-property>
      <key-property name="date" type="date">
        <column length="10" name="date"/>
      </key-property>
    </composite-id>
    <version name="version" type="java.lang.Long">
      <column name="version" precision="10" scale="0"/>
    </version>

i want to query
HibernateUtil.getCurrentSession().createQuery(“from RateCode where (RatecodeId (between|<) RateCodeId)”

SQL:
“from RateCode where roomId = 3000 and date > :fromDate and date < :toDate”

RatecodeId.java (composite)

public class RateCodeId implements java.io.Serializable {

    private int roomId;
    private Date date;

    public RateCodeId() {
    }

    public RateCodeId(int roomId, Date date) {
        this.roomId = roomId;
        this.date = date;
    }

    public int getRoomId() {
        return this.roomId;
    }

    public void setRoomId(int roomId) {
        this.roomId = roomId;
    }

    public Date getDate() {
        return this.date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public boolean equals(Object other) {
        if ((this == other)) {
            return true;
        }
        if ((other == null)) {
            return false;
        }
        if (!(other instanceof RateCodeId)) {
            return false;
        }
        RateCodeId castOther = (RateCodeId) other;

        return (this.getRoomId() == castOther.getRoomId())
                && ((this.getDate() == castOther.getDate()) || (this.getDate() != null && castOther.getDate() != null && this.getDate().equals(castOther.getDate())));
    }

    public int hashCode() {
        int result = 17;

        result = 37 * result + this.getRoomId();
        result = 37 * result + (getDate() == null ? 0 : this.getDate().hashCode());
        return result;
    }
}

how to set FromDate and Todate in Object and do condition of RateCodeID

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:39:57+00:00Added an answer on May 20, 2026 at 7:39 am
    String hql = "from RateCode rc where rc.id.roomId = 3000"
                 + " and rc.id.date > :fromDate"
                 + " and rc.id.date < :toDate";
    Query q = session.createQuery(hql);
    q.setParameter("fromDate", theFromDate);
    q.setParameter("toDate", theToDate);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CREATE TABLE `sequence` (`id` int(11) NOT NULL auto_increment, `load_status` varchar(100) default NULL, PRIMARY KEY
create table ImagenesUsuario { idImagen int primary key not null IDENTITY } This doesn't
create table snippet( id int not null auto_increment, primary key(id), idlanguage int not null,
Create table FavoriteDish ( FavID int identity (1,1) primary key not null, DishID int
CREATE TABLE jokecategory ( jokeid INT NOT NULL, categoryid INT NOT NULL, PRIMARY KEY
create table [User] ( UserId int primary key identity(1,1), FirstName nvarchar(256) not null, LastName
create table A ( id int(10) not null, val1 varchar(255), primary key (id) );
CREATE TABLE BlogPosts ( PostID INT PRIMARY KEY not null, PostTitle NVARCHAR , BlogID
create table #customer ( id int not null primary key, cust_name varchar(12), oldid int
CREATE TABLE Customer( customer_id INT NOT NULL, first_name VARCHAR(20), last_name VARCHAR(20), PRIMARY KEY (customer_id)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.