|
Order of adding mappings to Configuration is important when there is mixed mapping configuration (annotations+xml).
But according to http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch10.html documentation
You must specify an extends attribute in the subclass mapping, naming a previously mapped superclass. Previously this feature made the ordering of the mapping documents important. Since Hibernate, the ordering of mapping files is irrelevant when using the extends keyword.
If class Z, mapped with annotation, has a foreing key to class B, mapped with xml, and this class B is a sublcass of A - it is important, that A was added to Configuration before B.
If all three classes are mapped with xml - order isn't important.
There is test attached. Test mixedConfigurationWithReverseOrder is failed with
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on Z.b references an unknown entity: B
|