Đang chuẩn bị liên kết để tải về tài liệu:
manning Hibernate in Action phần 4
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
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 hibernate.default_schema 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 org.hibernate.auction.model.Category 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 org.hibernate.auction.model. 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 Cate-gory.hbm.xml xml version 1.0 DOCTYPE hibernate-mapping PUBLIC - Hibernate Hibernate Mapping DTD EN http hibernate.sourceforge.net hibernate-mapping-2.0.dtd hibernate-mapping class name org.hibernate.auction.model.Category 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 1.0 DOCTYPE hibernate-mapping PUBLIC - Hibernate Hibernate Mapping DTD EN http hibernate.sourceforge.net hibernate-mapping-2.0.dtd hibernate-mapping package org.hibernate.auction.model 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