my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes Different Mapping Types in Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Different Mapping Types in Hibernate" Watch "Different Mapping Types in Hibernate" New topic
Author

Different Mapping Types in Hibernate

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
One-to-One mapping means one pojo mapped with one table ,is it .
i read tutorials , but it was confusing.

Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
What tutorials did you read? A mapping refers to relationship between entities.

Look at this for more detail. one-one mapping
Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
I already saw this link. For one-to-one mapping why many-to-one is specified



Eduardo Yañez Parareda
Ranch Hand

Joined: Oct 09, 2008
Posts: 92

Rajendra Prakash wrote:One-to-One mapping means one pojo mapped with one table ,is it .
i read tutorials , but it was confusing.



Don't read tutorials, read the reference manual. This chapter explains what a mapping is and the relationships.
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html


http://serfj.sourceforge.net - Simplest Ever REST Framework for Java
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317


I meant the scenario that the OP described.

I have an Employee object and a Parking Space Object. The have a one to one relation i.e., an employee will always be associated to only one parking space, that parking space should not be associated to any other employee.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

One to one infers the relationship between objects, not the relationship between the object and the table.

Here is an example of a one-to-one mapping between objects, but both objects link to the same database table.



Tutorial on Mapping Two Classes to One Table


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different Mapping Types in Hibernate
 
Similar Threads
WA #1.....word association
how to insert
Hibernate Newbie - 1 to Many Relation Tutorial
Many to one object is null???
Websphere4.0 ApplicationAssemblyTool is hanging