CHAPTER 5 Inheritance and custom types name = (Web server application)

CHAPTER 5 Inheritance and custom types name = “CREDIT_CARD”, pkJoinColumns = @PrimaryKeyJoinColumn(name = “CREDIT_CARD_ID”) ) public class CreditCard extends BillingDetails { @Column(table = “CREDIT_CARD”, name = “CC_NUMBER”, nullable = false) private String number; … } If you don t specify a primary key join column for the secondary table, the name of the primary key of the single inheritance table is used in this case, BILLING_DETAILS_ID. Also note that you need to map all properties that are moved into the secondary table with the name of that secondary table. You also want more tips about how to choose an appropriate combination of mapping strategies for your application s class hierarchies. 5.1.6 Choosing a strategy You can apply all mapping strategies to abstract classes and interfaces. Interfaces may have no state but may contain accessor method declarations, so they can be treated like abstract classes. You can map an interface with , , , or , and you can map any declared or inherited property with
. Hibernate won t try to instantiate an abstract class, even if you query or load it. NOTE Note that the JPA specification doesn t support any mapping annotation on an interface! This will be resolved in a future version of the specification; when you read this book, it will probably be possible with Hibernate Annotations. Here are some rules of thumb: If you don t require polymorphic associations or queries, lean toward table- per-concrete-class in other words, if you never or rarely query for BillingDetails and you have no class that has an association to BillingDetails (our model has). An explicit UNION-based mapping should be preferred, because (optimized) polymorphic queries and associations will then be possible later. Implicit polymorphism is mostly useful for queries utilizing non-persistence-related interfaces. If you do require polymorphic associations (an association to a superclass, hence to all classes in the hierarchy with dynamic resolution of the concrete
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.