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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:57:59+00:00 2026-06-07T04:57:59+00:00

Is it possible to get as a result from hibernate directly this… List<Map<Sth, List<SthLog>

  • 0

Is it possible to get as a result from hibernate directly this…

List<Map<Sth, List<SthLog> list;

when classes are mapped in such a way (not bidirectional)?:

@Entity
public class SthLog {

        @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
    private Sth sth; }

I know that this maybe seems to be a silly question, because normally you can add bidirectional mapping, but in this case I can change entities definition and I wonder if I can get required structure directly from hibernate.

  • 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-06-07T04:58:01+00:00Added an answer on June 7, 2026 at 4:58 am

    Just don’t expect Hibernate to do everything for you. Transforming a List into a Map (or a Guava Multimap, which is easier and more appropriate here) is a matter of 3 lines of codes:

    // get all the SthLog with their sth
    List<SthLog> list = 
        session.createQuery("select s from SthLog s inner join fetch s.sth").list();
    // index them by their sth
    ListMultimap<Sth, SthLog> result = ArrayListMultimap.create();
    for (SthLog sthLog : list) {
        result.put(sthLog.getSth(), sthLog);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this possible to get result from a php file without using jQuery ?
Is it possible to call an exe file and get result from it? (basic)
Possible Duplicate: Get a list of dates between two dates This is my sql:
Is it possible to get 1 result where I require data from 3 tables.
Is it possible to get the result as below from the same table date-wise
Is it possible to get the result as below from the same table date-wise
It is possible in hibernate to get a result of a query to a
Is it possible to get objects from a list according to their indexes at
Possible Duplicate: Get file name from URI string in C# How to extract file
Possible Duplicate: Get all files from VSS for a given date? I need to

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.