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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:56:59+00:00 2026-06-08T04:56:59+00:00

I have this classes interface UserInterface Then abstract class user implements UserInterface Then i

  • 0

I have this classes

interface UserInterface

Then

abstract class user implements UserInterface

Then i have two child classes

Class Teacher extends User

Class Parent extends User

Now in the dtabase i have three tables

  1. user table with id,password
  2. teacher with FK and other stuff
  3. parent with FK and other stuff

Now i am checking the login using User class.

My problem is that if Employee logins then the object in memory will be of User type. How can then i get the Employee object

Is my model wrong and i need to do different way?

  • 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-08T04:57:02+00:00Added an answer on June 8, 2026 at 4:57 am

    Assuming Employee is a third subclass of User, then if a user logs in, and you get this user from the database using Hibernate, and this user is in fact an employee, then Hibernate will return an Employee instance. It works as you would expect.

    If it doesn’t, then you did something wrong, but it’s impossible to tell without seeing the code.

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

Sidebar

Related Questions

I have this two interfaces and classes: public interface Identifiable<T> { T getId(); }
I have this base class having the following interface: abstract class Base { abstract
I have this interface and classes: interface I { void method1(); } class A
If I have this classes: public interface IBinaryCalculator{ double addition(double numb1, double numb2); }
I have this structure of classes: public class L3Message { public int Number {
I have this application with 2 classes, in the first class I define a
I have this class that have a function to load other classes and create
having this two classes I always have a doubt of which is the best
I have this class class Validator implements iValidation{ protected $_fields, $_errors; public function __construct($fields){
Lets say we have this interface: interface IVehicle { ... } And some classes

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.