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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:41:20+00:00 2026-05-24T20:41:20+00:00

i created a class @Entity public class **Department** implements Serializable { @Id @GeneratedValue(strategy =

  • 0

i created a class

@Entity
public class **Department** implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    @OneToOne
    private **Doctor** head;
.........
}

As per the spec, when an entity Department references a single entity Doctor, no other Department s can refer the same Doctor
But i could make 2 different Department s refer to the same Doctor

ie, the Doctor id in the department table is not Unique

how its possible?

  • 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-05-24T20:41:21+00:00Added an answer on May 24, 2026 at 8:41 pm

    The mapping only describes how your entities should be saved to/loaded from the database. It doesn’t automatically insert constraints in the database schema, and does not make sure that all the data you create respects the mapping.

    You must create and enable the appropriate constraints in the database schema.

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

Sidebar

Related Questions

This is part of my model: @Entity public class Entry { @Id @GeneratedValue private
I've created class that takes Exception type in constructor private readonly Exception _exception; public
My bean looks like that: @Entity public class Fattura { @Id Long id; @NotEmpty
I have the following class: @MappedSuperclass public abstract class MappedModel { @Id @GeneratedValue(strategy =
I've created a class library that contains three entity models for three databases that
I created a class that's something like this: public class MovieTheaterList { public DateTime
I created a class that extends ProfileBase: public class CustomerProfile : ProfileBase { public
Given domain model... public class Entity { public int Id { get; set; }
Assume I have the following two classes: public class User : Entity { public
I have an entity called Medico which was created as an Entity Class from

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.