File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes hibernate mapping xml Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "hibernate mapping xml" Watch "hibernate mapping xml" New topic
Author

hibernate mapping xml

palas das
Greenhorn

Joined: May 09, 2007
Posts: 9
When we should use "identity" as generator class for id column.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

When you have defined an identity column in your DDL for the entity you are mapping.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
saranga rao
Ranch Hand

Joined: Apr 24, 2007
Posts: 49
If the database has an identity column associated with it, Hibernate can take advantage of the column to indicate when an object hasn�t been added to the database.
bren jas
Greenhorn

Joined: Feb 21, 2007
Posts: 12
Actually i have define a column of a table as primary key.
and for that column in mapping file i have put generator "identity"
But when I am going to insert data in that column it is giving exception
"ID does not have default value"

can anybody tell me why it is happening?
saranga rao
Ranch Hand

Joined: Apr 24, 2007
Posts: 49
hi,

which database you are using......... this will not support for Mysql


regards
saranga
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Actually i have define a column of a table as primary key.
and for that column in mapping file i have put generator "identity"

So you are not actually using an identity column? You will need to define the primary key field as an identity column if you want to use that key generation strategy.


which database you are using......... this will not support for Mysql

MySQL does indeed support identity columns.
[ May 10, 2007: Message edited by: Paul Sturrock ]
 
 
subject: hibernate mapping xml
 
developer file tools