Java Hibernate Tutorial Part 14 - Inheritance Mapping
Uploader Comments (patrickwashingtondc)
All Comments (20)
-
@sv2021 : Wow.. great... i have followed you and works great.. Thanks dude....
-
@HaveABeautifulLife : Remove @ID attribute, and assign primary key manually in Client program. Initially i have got same error, and i have rectified it by removing @Id attribute. Praveen
-
it's very helpful for me
-
Nice tutorial
-
Very Good Patrick like it ) its so simple when you expain . Great Job!
-
Changing @ Inheritance(strategy = InheritanceType.SINGLE_TABLE) to InheritanceType.JOINT or InheritanceType.TABLE_PER_CLAS
S wont work with @GeneratedValue(strategy = GenerationType.IDENTITY. For @ Inheritance(strategy = InheritanceType.JOINT) changing to GenerationType.AUTO worked.
For @ Inheritance(strategy = InheritanceType.TABLE_PER_CLAS
S) changing to GenerationType.TABLE worked.
Thanks again for the great tutorial.
-
Hi Patrick, your vedios have realy helped me a lot in learning hibernate. Thankyou very much. Greate work. All our good
wishes are with you. Thanks a lot.
-
Patrick, thanks a lot for these videos! They are most definitely very useful. However, i think that you should never recommend using JOIN statements when dealing with databases as it is by far the most expensive operation to perform in any database system. Speed is nowadays usually more important than space and thus, for general purpose, I think that the best strategy to recommend is the TABLE_PER_CLASS.
-
Hi, I have a problem when I put @ Inheritance
(strategy = InheritanceType.TABLE_PER_CLAS
S) I get the following error:
Exception in thread "main" org.hibernate.MappingException
: Can not use identity column key generation with mapping for hibernatechapter5Inheritancema pping.Module
question !!!
- how can you inherit a class prop that is not the next up.
-i want to use the prop form a class that is 3 clases up , without ussing some prop for the imidiate upper clases ???
MrOprea3 1 year ago
@MrOprea3 you can simply annotate the properties you don't want as transient. Check my previous videos.
patrickwashingtondc 1 year ago
Hi Patrick -- thanks once again for providing excellent training materials.
The first two strategies worked for me. I then dropped all tables, but 3rd strategy still fails with org.hibernate.Mapping-Exception: Cannot use identity column key generation with union-subclass mapping for: com.hibernate.chapter1.Project.
Do you know why I'm getting this error? Using Hibernate 3.4 and MySql 5.1
HaveABeautifulLife 1 year ago
@HaveABeautifulLife It doesn't matter what database you use. Physically deleting the tables should be enough to recreate them.
patrickwashingtondc 1 year ago
@patrickwashingtondc changing the generationtype strategy on ID worked for me too.. i had the mapping exception and this little modification worked wonder.. can you explain what is the difference between default strategy and Table
chintureddyk 1 year ago
@chintureddyk its explained in the videos
patrickwashingtondc 1 year ago