Monday, December 6, 2010

hibernate : mapping

The <id> element requires a <generator> element to be specified .
the generator's class  value is  [ guid | hilo |identity |increment |native |seqhilo |sequence |uuid ]  .

<one-to-one> Attributes :
* class => The property type of the attribute or field (if omit-
ted, this will be determined by reflection).
*constrained => Indicates that a foreign key constraint on the primary
key of this class references the table of the associated
class.
*foreign-key =>The name to assign to the foreign key enforcing the relationship.
*property-ref=>Specifies the column in the target entity’s table that
the foreign key references.

if you have an attribute of type Set, then you
will need to use a <bag> or <set> element to represent its relationship with the database.

the table attribute in the collection tags is representing The name of the table in which the associated entity is stored .

A bag(idbag) data structure permits unordered storage of unordered items, and permits duplicates .

<idbag name="idbag" table="nameidbag">
<collection-id column="id" type="int">
<generator class="native"/>
</collection-id>
<key column="fooid"/>
<element type="string" column="name" not-null="true"/>
</idbag>

No comments:

Post a Comment