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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:50:48+00:00 2026-06-16T20:50:48+00:00

Hello I have something like this @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class Person

  • 0

Hello I have something like this

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Person extends Model {
@Id  
public int id;

public String name;

public String lastName;
}

and

@Entity
public class User extends Person {
public Date registrationDate;

@ManyToMany(mappedBy="holders")
public List<Loan> loans = new ArrayList<Loan>();

public static Finder<Integer, User> find = new Finder<Integer, User>(Integer.class, User.class);
}

First of all. The table is created as I wanted and this is ok but I have two problems

First of all I cant make something like this

User user = new User();
user.name = "Dawid";
user.save();

I can’t do that cause I get error that dtype can’t be null but I can’t set it (or I just don’t know how to do this)

The second thing is that if I add the user from db I can’t get him by id when I do that I get sql error cause the where clausule looks like this

WHERE t0. AND t0.id = 1

as you can see there is t0. and nothing after dot and this ruins everything and I don’t know what it is doing there

  • 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-16T20:50:50+00:00Added an answer on June 16, 2026 at 8:50 pm

    For information, don’t use User as the table name since it is a keyword in many database server:

    @Entity
    @Table(name = "myUserTable")
    public class User extends Person {
    ...
    }
    

    But it is not your problem. AFAIK, Ebean supports only the SINGLE_TABLE strategy, so you’ll have to use this strategy, and you can specify the discriminator (ie dtype) name on subclasses using the @DiscriminatorValue annotation:

    @Entity
    @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
    public abstract class Person extends Model {
    ...
    }
    
    @Entity
    @DiscriminatorValue("aUser")
    public class User extends Person {
    ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have like this 2 tables class User public int UserId{get;set;} { ....
So if i have something like this: public class TestClass { public static void
I have some POCO objects that look something like this: public class Foo {
So basically, I have something like this: <h2 class=clickable>Hello</h2> And I want to make
I have a string containing something like this Hello bla bla bla bla ok,
I have a text file which contains something like this: Hello, my name is
I have a script that looks like this #!/bin/bash function something() { echo hello
Hello I have something like this: if(isset($_POST['btnProm'])){ $idads = mysql_real_escape_string($_POST['idAds']); require_once(adPromFrm.php); } When a
Lets say I have something like this uid tag 1 HeLLo 2 heLLO 3
Hello people I have something like this Two integers for example : int priceSell

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.