File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Basic hibernate code explanation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Basic hibernate code explanation" Watch "Basic hibernate code explanation" New topic

Basic hibernate code explanation

ashwin bala
Ranch Hand

Joined: Dec 07, 2009
Posts: 41
The bean for first table is,

the bean for next table is

the Employee.hbm.xml file is

the java file is

now can you please tell me what are the columns in the first and second table?
and also tell why emp_id is not filled but address and country are filled ?

i have implement hibernate in my application. help me with this issue.
Thanks in advance

David Newton

Joined: Sep 29, 2008
Posts: 12617

Nothing to do with Spring, moving to ORM.
David Newton

Joined: Sep 29, 2008
Posts: 12617

The columns are listed in your Hibernate mapping. IDs are usually generated--see the <generator> tag?

I'd suggest taking a step back and reading some Hibernate documentation and going through a tutorial or two before trying to proceed much further.
Ryann Ong

Joined: Jan 24, 2010
Posts: 19

Hi Ashwin,

David is correct, Hibernate has its own feature of handling IDs by using the <generator> tag. The <generator> tag creates an identification for each Java class to generate unique identifiers for persistent class.

Here is a good link about Hibernate:

I agree. Here's the link:
subject: Basic hibernate code explanation
It's not a secret anymore!