File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different Mapping Types in Hibernate

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One-to-One mapping means one pojo mapped with one table ,is it .
i read tutorials , but it was confusing.

 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 293
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already saw this link. For one-to-one mapping why many-to-one is specified



 
Eduardo YaƱez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic