tailieunhanh - manning Hibernate in Action phần 4
Tham khảo tài liệu 'manning hibernate in action phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Defining the mapping metadata 83 However a better way to handle this kind of requirement is to use the concept of an SQL schema a kind of namespace . SQL schemas You can specify a default schema using the configuration option. Alternatively you can specify a schema in the mapping document. A schema may be specified for a particular class or collection mapping hibernate-mapping class name table CATEGORY schema AUCTION . class hibernate-mapping It can even be declared for the whole document hibernate-mapping default-schema AUCTION . hibernate-mapping This isn t the only thing the root hibernate-mapping element is useful for. Declaring class names All the persistent classes of the CaveatEmptor application are declared in the Java package . It would become tedious to specify this package name every time we named a class in our mapping documents. Let s reconsider our mapping for the Category class the file xml version DOCTYPE hibernate-mapping PUBLIC - Hibernate Hibernate Mapping DTD EN http hibernate-mapping class name table CATEGORY . class hibernate-mapping 84 CHAPTER 3 Mapping persistent classes We don t want to repeat the full package name whenever this or any other class is named in an association subclass or component mapping. So instead we ll specify a package xml version DOCTYPE hibernate-mapping PUBLIC - Hibernate Hibernate Mapping DTD EN http hibernate-mapping package class name Category table CATEGORY . class hibernate-mapping Now all unqualified class names that appear in this mapping document will be prefixed with the declared package name. We assume this setting in all mapping examples in this book. If writing XML files by hand using the DTD for auto-completion of course still
đang nạp các trang xem trước