Java Reference
In-Depth Information
Table 7-2. The <hibernate-mapping> Attributes
Attribute
Values
Default
Description
auto-import
true , false
true
By default, allows you to use the unqualified
class names in Hibernate queries. You would
normally only set this to false if the class
name would otherwise be ambiguous.
catalog
The database catalog against which queries
should apply.
default-access
property
The default access type. If set to property , then
get and set methods are used to access the
data. If set to field , then the data is accessed
directly. Alternatively, you can provide the
class name of a PropertyAccessor implementa-
tion defining any other access mechanism.
default-cascade
Defines how (and whether) direct changes to
data should affect dependent data by default.
default-lazy
true , false
true
Defines whether lazy instantiation is used by
default. Generally, the performance benefits
are such that you will want to use lazy instanti-
ation whenever possible.
package
The package from which all implicit imports
are considered to occur.
schema
The database schema against which queries
should apply.
The default cascade modes available for the default-cascade attribute (and for the cas-
cade attributes in all other elements) are as follows:
create, merge, delete, save-update, evict, replicate, lock, refresh
These correspond to the various possible changes in the lifestyle of the parent object.
When set (you can include combinations of them as comma-separated values), the relevant
changes to the parent will be cascaded to the relation. For example, you may want to apply
the save-update cascade option to a class that includes Set attributes, so that when new per-
sistent classes are added to these, they will not have to be saved explicitly in the session.
There are also three special options:
all, delete-orphan, none
all specifies that all changes to the parent should be propagated to the relation, and none
specifies that none should. delete-orphan applies only to one-to-many associations, and speci-
fies that the relation should be deleted when it is no longer referenced by the parent.
The required order and cardinality of the child elements of <hibernate-mapping> are as
follows:
(meta*,
typedef*,
import*,
(class | subclass | joined-subclass | union-subclass)*,
(query | sql-query)*,
filter-def*)
Search WWH ::




Custom Search