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 6619491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:58:33+00:00 2026-05-25T20:58:33+00:00

I tried to look around for information regarding returning a list using Hibnerate but

  • 0

I tried to look around for information regarding returning a list using Hibnerate but couldn’t find something that matches what I’m looking for and thus needs some advise.

I have the following classes

BPDataPK:

  public class BPDataPK implements Serializable {
    private String id;
    private int userProfile;
    private Date when;      
         .....
  }

BPData:

public class BPData implements Serializable {   
   private BPDataPK dataPK;
   private Date sessionStart;
    ...
}

HibernateBPDataDAO :

public class HibernateBPDataDAO extends HibernateDaoSupport implements IBPDataDAO{
    ....
public BPData[] getSessionBPData(Session session) throws Exception {
        /**I need to get a list of BPData that matches the following
        1.  BPDataPK.id== session.getID;
        2.  BPDataPK.userProfile == session.getUserProfile;
        **3.  BPData.sessionStart  == session.getSessionStart();**
        */
    }
 }

How do I return a list of BPData that matches two of the primary key and a non primary key??

  • 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-25T20:58:34+00:00Added an answer on May 25, 2026 at 8:58 pm

    You should not look around for some information. Instead, you should read the reference documentation.

    This documentation has a full chapter dedicated to queries using the HQL query language, and another one dedicated to criteria queries. Since you have a fixed set of criteria here, HQL is more suited to the task:

    String hql = "select b from BPData b where b.dataPK.id = :id"
                 + " and b.dataPK.userProfile = :profile"
                 + " and b.sessionStart = :sessionStart";
    Query q = hibernateSession.createQuery(hql);
    q.setString("id", session.getID());
    q.setInt("profile", session.getUserProfile());
    q.setTimestamp("sessionStart", session.getSessionStart()); // or setDate, depending on the type of this field
    List<BPData> result = q.list();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried to look around for postings that might help me, cant find any.
Really tried to look around, used search. Used Google, tried many ways, but I
I've had a look around the web regarding this, but haven't found the exact
What should data look like before data encoding in: urllib2.Request(someurl,data) I tried [('name1','value1'),('name2','value2'),...] but
tried to find the answer by googling and in MSDN but with no luck.
I have taken a look around Stack Overflow on the topic of onblur but
I tried to look for benchmark on the performances of various filesystems with MySQL
I have tried this example http://www.bennadel.com/blog/1056-ColdFusion-CFPOP-My-First-Look.htm , but it retrieve emails from POP server.
Edit: Of course my real code doesn't look exactly like this. I tried to
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo

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.