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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:32:13+00:00 2026-06-17T10:32:13+00:00

I have spent hours looking how to solve this. When I try to get

  • 0

I have spent hours looking how to solve this. When I try to get parent from a child all but it’s id fields are empty. It just makes no sense. I am using PlayFramework 2.0.4 if that might indicate anything (besides a terrible choice of framework).

TRoute.java (parent)

@Entity  
@Table(name="routes")
public class TRoute extends Model {

    @Id
    public String route_id;
    public String agency_id;
    @Constraints.Required
    public String route_short_name;
    @Constraints.Required
    public String route_long_name;
    public String route_desc;
    @Constraints.Required
    public String route_type;
    public String route_url;
    public String route_color;
    public String route_text_color;

    @OneToMany(mappedBy="troute")
    public List<Trip> trips;

    public static Finder<String, TRoute> find = new Finder(
            String.class, TRoute.class
    );

}

Trip.java (child)

@Entity  
@Table(name="trips")
public class Trip extends Model {

    @Constraints.Required
    public String route_id;
    @Constraints.Required
    public String service_id;
    @Id
    public String trip_id;
    public String trip_headsign;
    public String direction_id;
    public String block_id;
    public String shape_id;

    @ManyToOne
    @JoinColumn(name="route_id")
    public TRoute troute;

    public static List<Trip> byRouteId(String route_id) {
        List<Trip> trips = 
            Trip.find
            .where().like("route_id", route_id)
            .findList();
        return trips;
    }

    public static Finder<String, Trip> find = new Finder(
            String.class, Trip.class
    );

}
  • 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-17T10:32:15+00:00Added an answer on June 17, 2026 at 10:32 am

    The finder has a fetch() method which can be used to load properties of the other table. Something like:

    public static List<Trip> byRouteId(String route_id) {
        List<Trip> trips = List<Trip> trips = Trip.find
            .fetch("troute") // fetch the other table's properties here
            .where()
            .like("route_id", route_id)
            .findList();
        return trips;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this seems basic, but I have spent hours looking at docs and
This might be a stupid question but I have spent 2 hours looking for
I'm sorry to ask this question but I have spent hours trying to understand
Have spent an hour trying to solve this - but to no avail. I'm
I have spent many hours looking into this and I still can't find a
I have spent some hours looking for a Rails3 dojo-toolkit UJS-driver but I had
I have spent the last couple of hours looking through other questions on this
I've spent hours looking up how to fix this problem but nothing has worked.
Hi am new to android and have spent over 10 hours looking for this
I have spent the past couple of hours trying all types of variations but

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.