facebook

Subclasses not allowed to have "natural-id" tag in

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #246059 Reply

    geminygirl1
    Member

    I shall try to explain by a small example. I have aclass called “person” which has say an attribute “name” and “Birthday”. I have a subclass of class “Person” called “Employee” and “Employee” has an attribute “ssn” which I want to treat as a natural-id. But Hibernate doesnot allow this. It doesnt allows natural-id tags for any subclass tag.
    I would really appreciate some help on this. I have tried to serach for some example mapping similar to my example but havent had any luck. If teher is some alternate way for me map this do let me know.

    #246060

    geminygirl1
    Member

    I am new to Hibernate. After readinga lot of forums on the net and going through the Hibernate DTD I came across the “key” element that can be used with the subclasses but it seems to be refering to the PK column of the parent class.
    This issue is blocking me from moving ahead. I would really appreciate any help on this.

    #246064

    Haris Peco
    Member

    see chapter 4.2 in hibernate documentation
    this is important
    ‘A subclass must also observe the first and second rules. It inherits its identifier property from the superclass, Cat.’

    you can change ID in subclas, but if you have to use SSN (for example) try with unique-key – unique key have features similar PK – it garanty uniqueness and you can make foreign key with him

    regards

    #246066

    Haris Peco
    Member

    you can change ID in subclass …

    you can’t , of course
    I’m sorry

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Subclasses not allowed to have "natural-id" tag in

You must be logged in to post in the forum log in