What is component mapping in hibernate?

By: Emiley J. Emailed: 1598 times Printed: 2046 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

A component is a contained object that is persisted as a value type ,not an entity reference.

Example:

public class person{

private Name name;

public Name getName(){ return name;}

public void setName(Name name){this.name=name;}

.....

}

public class Name

{chat initial;

String first;

String last;

public char getInitial(){return initial;}

public void setInitial(char initial){this.initial=initial;}

.......//first,last

}

Now 'Name' may be persited to the component of 'person'

in hbm:

<class name="eg.Person" table="person">
    <id name="Key" column="pid" type="string">
        <generator class="uuid"/>
    </id>
    <property name="birthday" type="date"/>
    <component name="Name" class="eg.Name"> <!-- class attribute optional -->
        <property name="initial"/>
        <property name="first"/>
        <property name="last"/>
    </component>
</class>

The person table would have the columns pid, birthday, initial, first and last.


Hibernate Home | All Hibernate Tutorials | Latest Hibernate Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Emiley J.
Error generating R.java from manifest
ERROR 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client
IIS and Tomcat - how to configure to work together
PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/php4/lib/php/extensions/no-debug ......
Adding your own Application icon for your J2ME application (jar file)
Creating Menus in Code using VB.net
Traversing all files in a directory using Ruby
Using Proxy to connect to URLs in Ruby
POST a form in Ruby
Reading URL content using Ruby (HTTP)
dRuby client/server mode sample program
Benchmark module in Ruby
encoding and decoding in Ruby using Base64 Module
Module Abbrev in Ruby
Standard Library Packages in Ruby

More Tutorials in Hibernate
Fetching strategies in Hibernate
equals() and hashCode() in Hibernate
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
EntityNameResolvers in Hibernate
Hi/lo algorithm in Hibernate
Identity columns and sequences in Hibernate
Assigned identifiers in Hibernate
Primary keys assigned by triggers in Hibernate
Formula in Hibernate
Step by Step Hibernate - Your First Hibernate Application
A sample Hibernate Web Application using Servlets
Some Basic APIs in Hibernate
Contextual sessions in Hibernate
Programmatic configuration in Hibernate
SessionFactory in Hibernate

More Latest News
Most Viewed Articles (in Hibernate )
Hibernate Vs. JDBC ( A comparison)
Contextual sessions in Hibernate
What is component mapping in hibernate?
Hibernate Configuration Properties
equals() and hashCode() in Hibernate
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
Identity columns and sequences in Hibernate
Formula in Hibernate
Delta Electronics Chairman Bruce Cheng Endows NCKU Build Y.S. Sun Green Building Research Center
Step by Step Hibernate - Your First Hibernate Application
Types of inheritence models in Hibernate
Paging Through the Result Set in Hibernate
Download Hibernate latest version
Tutorial Using the Java Persistence API (JPA) in Hibernate
A sample Hibernate Web Application using Servlets
Most Emailed Articles (in Hibernate)
Hibernate Vs. JDBC ( A comparison)
Step by Step Hibernate - Your First Hibernate Application
Delta Electronics Chairman Bruce Cheng Endows NCKU Build Y.S. Sun Green Building Research Center
Contextual sessions in Hibernate
Creating Connection Pool for JDBC Connections in Hibernate
Hibernate Cache Properties
Hibernate JDBC and Connection Properties
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
Assigned identifiers in Hibernate
Primary keys assigned by triggers in Hibernate
Formula in Hibernate
Types of inheritence models in Hibernate
What is component mapping in hibernate?
Paging Through the Result Set in Hibernate
Download Hibernate latest version