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

  • Home
  • SEARCH
  • 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 8795847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:28:50+00:00 2026-06-13T23:28:50+00:00

My data model: public class Tour extends Model { @Id public Integer id; @ManyToOne

  • 0

My data model:

public class Tour extends Model {    
    @Id
    public Integer id;

    @ManyToOne
    public Sport sport;

    @OneToOne(mappedBy="genericTour")
    FootballTour footballTour;

    @OneToOne(mappedBy="genericTour")
    TennisTour tennisTour;

    public static Finder<Integer, Tour> find(){
        return new Finder<Integer,Tour>(Integer.class,Tour.class);
    }
}

public class FootballTour extends Model {

    @Id
    public Integer id;

    @OneToOne
    Tour genericTour;

    public static Finder<Integer, FootballTour> find(){
        return new Finder<Integer,FootballTour>(Integer.class,FootballTour.class);
    }

}

My action(just to show that I’m fetching “footballTour”):

  public static Result getToursBySportTag(String sportTag){

      Query query = Tour.find().fetch("sport").fetch("footballTour");
      List<Tour> finedTours =  query.where().eq("tag", sportTag).findList();

      return ok(tours.render(finedTours));

  }

In scala template I want to acess footballTour field of Tour:

@(tours: List[Tour])
@main("Football tours") {
<h1>Football tours List</h1>
<dl>
@for(tour <- tours) {
<dt>
<a href="@routes.Application.tour(tour.id)">
@tour.footballTour.id
</a>
</dt>
}
</dl>
}

And have error at compilation time:

[error] one error found [error]
{file:/C:/Users/pc/prog/}prog/compile:compile: C ompilation failed
[info] Compiling 1 Scala source to C:\Users\pc\prog\target\scala-2.
9.1\classes… [error] C:\Users\pc\prog\target\scala-2.9.1\src_managed\main\views\
html\tours.template.scala:37: variable footballTour in class Tour
cannot be acce ssed in models.Tour
[error]
“””),display(SeqAny),format.raw/8.11/(“””
– “””),display(SeqAny),format.raw/8.
35
/(“”” [error]

  • 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-13T23:28:51+00:00Added an answer on June 13, 2026 at 11:28 pm

    The field genericTour of the FootballTour class should be public:

    public class FootballTour extends Model {
    
        @Id
        public Integer id;
    
        @OneToOne
        public Tour genericTour;  // <<<<< Here !!
    
        public static Finder<Integer, FootballTour> find(){
            return new Finder<Integer,FootballTour>(Integer.class,FootballTour.class);
        }
    
    }
    

    In java, by default, in not specified, the fields are private.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what my data model classes look like: public class Employee { public
This is how my data model for USER looks like public class User {
I have one class where I store my data: class Model { public int
Using this model: public class Cases { //case data model for call center //implement
I have the following data model class defined: @PersistenceCapable public class TestSerializableModelObj { @Persistent(serialized=true,
I want to create a Model: public class TestModel { Microdata(Data = data-test=this is
To start with, below are my two model classes. public class DataModel { [Required]
Is Model only Entity Data Model class of my database? Model as simple place
I've created an AS class to use as a data model, shown here: package
I have model public class MyModel { public string Name { get; set;} }

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.