Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Java Tutorials



Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Hibernate Incrementgenerator

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

34 comments so far (post your own) View All Comments Latest 10 Comments:

You can run the above class's code without creating the table in the database. When you run the java application for the first time the application will create the row and insert data in the table.

Posted by mithun on Thursday, 03.18.10 @ 11:34am | #95652


In java through hibernet i can easily insert the data in the oracle database but i doesn't no how to retrive the data from database and to use in my application
pls ...help me to go for next level in hibernet

Posted by Anand on Saturday, 01.23.10 @ 16:32pm | #94252

This is jagadhish.I compiled this first example.but iam getting an error that is import org package like that.Iam new to this hibernate.Already i wrote import statement about sessions and sessionfactory.plz help me to solve this problem.

Posted by jagadhish on Thursday, 07.2.09 @ 11:58am | #88973

Hi ,

I am also facing same issue while running First Example. Can any one help us

Posted by Ajay on Wednesday, 07.1.09 @ 23:52pm | #88962

Hi I am facing strange issue.

The whole program runs fine but there is not entry made in database.

do u find any reason behind it?

Posted by Bhavesh Shah on Monday, 06.8.09 @ 14:25pm | #88324

Instead of incrementing value by one, how can i increment value by two?

Posted by satyarajasekhar on Monday, 05.25.09 @ 17:38pm | #88010

I have implemented the code above using netbeans 6.1 IDE but i don't seem to have the records inserted to the database table and there are no errors also.What could be the cause of this scenario?

Posted by Kiprotich Chemweno on Friday, 02.27.09 @ 04:03am | #85284

very useful info

Posted by santosh damre on Thursday, 11.20.08 @ 01:11am | #81839

Thanks for the tutorial!!

Posted by Kirpheaice on Friday, 10.24.08 @ 15:28pm | #81298

I am getting next:

Database(): group="null"
Database(): group="null"
Database(): group="null"
Cannot open connection

And so in each example... can any one help me in this?

Posted by bandr on Tuesday, 08.5.08 @ 03:20am | #70994

In my table i donthave any primary key and the main column which i use to retreive data is text type.
So can i declare like this in hbm

<id name="lngBookId" type="java.lang.String" column="id" >
<generator class="assigned"/>

Posted by sandy on Monday, 05.26.08 @ 17:57pm | #61083

Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '4' for key 1"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1540)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 44 more

Posted by nikunj on Wednesday, 05.14.08 @ 14:04pm | #59783

org.hibernate.MappingException: Error reading resource: contact.hbm.xml

Posted by ghouse on Thursday, 04.24.08 @ 22:56pm | #57813

hi thank for roseindia for providing hibernate .As i already hibernate already i enjoyed alot by reading the entire hibernate.
Not only providing basic code i request roseindia
to provide interview questions for the students and employees, by that they can gain alot from this site

Posted by gurunath on Monday, 04.14.08 @ 23:33pm | #56411

As a novice,After a long google search for Hibernate documents, I have found this site. This is very useful.I Wholeheartedly thank roseindia.net for their valuable help. Beginners will definitely find this site pretty useful.

Posted by Karthik on Wednesday, 01.9.08 @ 15:37pm | #44847

this site is very usefull but i am sufferring some problem my hibernate prog for storing the data works fine but data is not store in that
and on cosole this is o/p i also create trasaction object and commit.
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select max(objectid) from dtproperties
Hibernate: insert into dtproperties (property, value, version, objectid) values (?, ?, ?, ?)
Data inserted into database

Posted by rajesh Bobe on Tuesday, 01.1.08 @ 14:31pm | #44317

I am getting the below error while executing second example book
"could not fetch initial value for increment generator"
need solutions..

Posted by srinivas on Wednesday, 12.12.07 @ 13:00pm | #41923

WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/test/hibernate/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Exception in thread "main" java.lang.NullPointerException at oseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:36)

Posted by bayaaaaa on Friday, 12.7.07 @ 06:29am | #41491

Excellent.. it gives exact information what a beginner needs

Posted by bhoopal reddy on Tuesday, 10.23.07 @ 13:37pm | #34614

I am executing the first example, I am getting an exception...
org.hibernate.InvalidMappingException: Could not parse mapping document from resource contact.hbm.xml

Help me out in solving this problem.

Posted by Rupa on Thursday, 10.4.07 @ 15:38pm | #31364

@ brijesh Kachalia & kanchan : I may not be an expert on this, but my guess is that your contact.hbm.xml is not placed in the correct directory...

Posted by Andrew on Wednesday, 03.28.07 @ 06:22am | #12817

i hav developed a hibernate program & found an error----------Error reading resource: contact.hbm.xml.
can any one help me in this???????

Posted by kanchan on Tuesday, 03.20.07 @ 11:35am | #12244


Really ,this is very useful site for beginners.
Thanks to roseindia.net

Posted by Avani on Monday, 03.12.07 @ 22:55pm | #11522

How can I use the generator for a property instead of primary key, because I want Hibernate to generate unique id to be inserted in a column in table thats not primary key.

Posted by Sami Al-Sayyed on Tuesday, 02.20.07 @ 16:32pm | #8487

I want to say thanx rose india to help really for hibernate tutorial.

Posted by Udya on Friday, 02.2.07 @ 01:28am | #5295

ya really this site is so good , i got so much things about hibernate.previously i was idea on hibernate but by going through this site my idea on hibernate is increased.

Posted by Sanjeet on Friday, 01.19.07 @ 17:33pm | #3840


Wow !!!
Its wonderfull to have that much basic on hibernate specially, for the person who is new and desparate.

Devi Jyothi Alluri

Posted by devi jyothi alluri on Tuesday, 01.9.07 @ 14:40pm | #3018


I am very new to hibernate and by going through this tutorial i get enough on that to up with.

Posted by devi jyothi on Tuesday, 01.9.07 @ 14:37pm | #3017

Looks good site to getting started

Posted by vijay on Friday, 01.5.07 @ 19:52pm | #2722

can you send me suggestion for the below error

i am runnig this first example in eclipse

Could not parse mapping document from resource contact.hbm.xml

Posted by brijesh Kachalia on Tuesday, 01.2.07 @ 12:13pm | #2403

Respected sir
i have develop hibernate program under the guidance of tutorial provided by ur site.
I have used 'sun.jdbc.odbc.JdbcOdbcDriver' for accessing my oracle database. My program is creating table but then a exception is thrown
'Could not execute jdbc batch update'
ur site material is very useful for java develpor also who want to become java develpor

Posted by keshav on Tuesday, 12.12.06 @ 21:33pm | #906

i am new to hibernate and getting the following exception:
org.hibernate.MappingException: Could not read mappings from resource: com/hibernate/testing/test/ebData.hbm.xml

org.hibernate.MappingException: Could not parse mapping document in input stream

can someone just help me out wid dis?

Posted by priyanka on Friday, 12.8.06 @ 11:49am | #625


Posted by JAVIPLAY on Thursday, 11.30.06 @ 20:54pm | #259

It is useful for java developer.

Posted by suresh on Wednesday, 11.29.06 @ 07:49am | #188

Ask programming questions?



Back to Tutorial


  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.