Home Tutorialhelp Allcomments Hibernate Firstexample

 
 

Comments

 
User Comments for the tutorial:

Writing First Hibernate Code



Total comments: 236      View Tutorial    Discuss: Writing First Hibernate Code
Advertisement
Comments

I love this page! I'm new to java technology and
I love this page! I'm new to java technology and Your website helps me much! I'll recomment this page to my friends. Thank you very much!  

Hi i'm trying to implement the above example but i
Hi i'm trying to implement the above example but i got fatal exception . first of all i couldnt able to create sessionfactory. null pointer exception occured at the creating of sessionfactory. pls do advise me. Thanks 

you have given but somewhat it confused.
you have given but somewhat it confused. 

you have given but somewhat it confused.
you have given but somewhat it confused. 

you have given but somewhat it confused.
you have given but somewhat it confused. 

I'm new to Hibernate, and this tutorial helped me
I'm new to Hibernate, and this tutorial helped me a lot. Thank you so much Deepak!! Keep up the good work :) 

hi i'm new to hibernate and i need to use mysql ma
hi i'm new to hibernate and i need to use mysql maxdb, but have problems with the hibernate.cfg.xml and drivers thta i need to add to the build path of my project can smb help me 

I am new to hibernate... I just gone through it..
I am new to hibernate... I just gone through it...very nice and easy to understand.. 

Hello Sir, I have seen roseindia.net for first ti
Hello Sir, I have seen roseindia.net for first time might be this is the best tutorial i have ever seen on Internet which teaches completely from the scratch.  

Need some more information on Bundling of the pack
Need some more information on Bundling of the package and how we can relate to actual senario 

Hi Harish, You wrap the session.save() method w
Hi Harish, You wrap the session.save() method within transaction block and then commit the transaction. SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session =sessionFactory.openSession(); Transaction  

The example is not showing any errors. But, it i
The example is not showing any errors. But, it is not inserting the record. Weblogic 8.1 and Oracle 8i environment. 

hello Depak the example is presented very nicely
hello Depak the example is presented very nicely thanks for ur efforts....keep it up.. 

Great work! I am very new in Hibernate even today
Great work! I am very new in Hibernate even today is my first day and my understanding of it is good just coz of RoseIndia and Mr. Deepak. Keep it up.  

Excellent artical. Very easy to read and suitable
Excellent artical. Very easy to read and suitable for the beginners. Well done Deepak. cheers,  

Tutorial is excelent i am having following probl
Tutorial is excelent i am having following problem when i am running first example in eclipse tables are created but records are not getting in mysql. Thanks for such a good tutorial :).  

Hi, Tutorial is good and very useful for the be
Hi, Tutorial is good and very useful for the beginners. Clearly explained with the examples. Thanku for one and all who contributed their efforts for this roseindia.net. Thanks & Regards, G.Sailatha 

Hi deepak, This is the best beginners tutorial I
Hi deepak, This is the best beginners tutorial I have seen till now.. Compared to others it makes the point straight forward, and is quite simple..... thanks a lot... 

Hi Your website is very helpful to me,coz i have
Hi Your website is very helpful to me,coz i have got from this, Keep it up Thanks and Regards Balraj Kumar 

gud example. keep the gud work.
gud example. keep the gud work. 

Dear Sir, really it was a very nice excersise f
Dear Sir, really it was a very nice excersise for me .I am also new to Hibernate.I followed your instruction. I got the message Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?) but the values are not inserting 

hi Deepak, i tried your hibernateexample all exam
hi Deepak, i tried your hibernateexample all examples are working fine except First Example, it showing same output on the console of eclipse but not inserting the records. but other examples are working fine with database. plz help 

Thank you very much! This is by far the least com
Thank you very much! This is by far the least complicated tutorial for getting started with hibernate. Can't say the same for the rest of them :( Keep up the good work ;) 

nice to get such avery useful code here only
nice to get such avery useful code here only 

nice tuts....vv helpfull
nice tuts....vv helpfull 

Hi almost i got executed hibernate application.but
Hi almost i got executed hibernate application.but iam getting one execption that is javax/transaction/synchronized how to eliminate this error. what should i do please reply as soon as Thanks & regards 

hi all,this is one of the site to learn,which incl
hi all,this is one of the site to learn,which included here step by step. thanks naidu 

This website contains very useful tutorials...illu
This website contains very useful tutorials...illustrated in a very simple way...most of the tutorials helped me to learn & experiment new things in java world.... thanks.... 

I have exeption nullpoint in line SessionFactory
I have exeption nullpoint in line SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); I brocked line to 2 lines Configuration conf = new Configuration(); SessionFactory sessionFactory = conf.configure().buildS 

hi all, this is one of the tutorial which
hi all, this is one of the tutorial which ll guide u in an efficient manner for those who want to excel in Hibernate...it gives u the very basic knowledge of what hibernate is....so a good foundation for ur skill regards Suma Manohar Hum 

Thankyou... thankyou... I've been pulling my hair
Thankyou... thankyou... I've been pulling my hair out trying to wrap my head around hibernate with MySQL and I've searched the net high and low. This simple tute answered more of my questions than any of the examples on the hibernate website or any  

how to create the config.xml in eclipse IDE
how to create the config.xml in eclipse IDE 

RoseIndia tutorials are simple enough for beginner
RoseIndia tutorials are simple enough for beginners like me. Thank you so much. 

very nice tutorial man. i hav already worked on h
very nice tutorial man. i hav already worked on hibernate, just now saw ur code, for beginners it is very very useful. pl continue, by creating these kind of, simple tuts.. thank u..  

Hi Deepak, I am able to run it successfully. I
Hi Deepak, I am able to run it successfully. I have set ID column as Auto_Increment primary key, so I commented setting ID value and when executing, it is giving error as: Could not execute JDBC batch update How to go about it? Thank you i 

hi iam new to hibernate. iam using hssqldb.jar a
hi iam new to hibernate. iam using hssqldb.jar as a database. if anything i missed plz rectify me.. 1) i properly configured hibernate.cfg.xml & mapping file. 2) i started hsqldb server 3) when run my application am getting this kind of excep 

right now if u FirstExample it will not insert the
right now if u FirstExample it will not insert the data into the database. To insert the data we need to add u more line of code i.e as follows --> Transaction tx = session.beginTransaction(); --> tx.commit(); FirstExample.java =========== 

Hi Deepak, Thanks a lot for such a useful tutor
Hi Deepak, Thanks a lot for such a useful tutorial. I am new to hibernate and now I think this tutorial will help me become familiar with it soon. Thanks Again 

Show us the steps not the code , we beginners want
Show us the steps not the code , we beginners want the steps not the code . This document is not formatted and misguide us . We need simple steps . If anybody can help , please help me .. Thanks 

hi... this is a very good tutorial for the begi
hi... this is a very good tutorial for the beginners.... i would like say thanks to all of u who has done this.. All the best Hridayesh kalauni 

Thanx a lot, excellent material.
Thanx a lot, excellent material. 

I am new to hibernates, I would like to know direc
I am new to hibernates, I would like to know directory structure of deploying and placing xml and java classes. Also to compile them as step by step process. please help me 

One of the best places to learn about almost anyth
One of the best places to learn about almost anything in a fast and simple manner. I have been referring to this site so often and a great tool to help yourself to get into the race immediately. Thanks all 

As a beginner to hibernate technology, I find this
As a beginner to hibernate technology, I find this tutorial very useful . Initially I faced some problems while running the application. Like I was not able to view data added to the database. I tried with mysql 4.1.21 and added 3.1.14 as mysql  

Good tutorial for beginners. Thanks, Sandeep
Good tutorial for beginners. Thanks, Sandeep 

plz help me get the ddl statements in an file.im n
plz help me get the ddl statements in an file.im not getting it inspite of providing the attribute <schemaexport output="hello.sql" 

Great tutorials! Thanks so much!
Great tutorials! Thanks so much! 

when i try to run this im getting this error log4
when i try to run this im getting this error log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NoClassDefFoundError: net/ 

Regarding Arun, make sure you have these jar fi
Regarding Arun, make sure you have these jar files added to avoid errors.. commons-collections/3.2/commons-collections-3.2.jar dom4j/1.6/dom4j-1.6.jar log4j/1.2.11/log4j-1.2.11.jar postgresql/8.1-404.jdbc3/postgresql-8.1-404.jdbc3.jar hiber 

I could insert the records into dbase, with out us
I could insert the records into dbase, with out using the transaction.commit(). Any reason for this to happen . Please can you let meknow.. thanks, Srini 

This is a terrific tutorial and much better than a
This is a terrific tutorial and much better than any book I can buy. It helped me a lot with my work. May you always be able to write great lessions like this! 

this tutorial helps me to understand about hiberna
this tutorial helps me to understand about hibernate. 

Hi, really this is site is very useful not for th
Hi, really this is site is very useful not for the biggners also for the experience people....I am trying to develop a small appliaction in hibernate.jsut to show the contents of the tables thru class..but i am facing following errors anybody can he 

Good job done!! Its really usefull n interesting!
Good job done!! Its really usefull n interesting!!! Pretty simple to understand also!! 

hi this is very good website to beginer and
hi this is very good website to beginer and thank you verymuch for website people and staff ok bye hava a nice day  

Comment..
Excellent. Very simple way of explaing how to configure the hibernate. good one.. 

Data Not getting inserted into the Contact Table
I am working MySQL Server and Hibernate as suggested in the example.After executing the client to insert a record neither do I get any exception nor does the data gets inserted into the contact table.Wondering where the data is going ???  

no database insert
Hi, I have the same problem as Anand. I extracted the sample app, set the config etc... the app runs fine with no exceptions... the table is created but no record is inserted. any ideas? win xp, my sql 5, eclipse 3.2, java 1.5 cheers. 

/hibernate.cfg.xml not found
I am getting the following error message when i execute this program in eclipse. I am not aware where to put the hibernate.cfg.xml file log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initial 

My Hibernate-cfg. xml file has errors
Hi, i got following error message when i executed simple java application. WARNING: No connection properties specified - the user must supply JDBC connections Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be  

Data not inserted in MYSQL database
Hi, I am trying the same tutorial as suggested and also the program (FirstExample.java) is running in eclipse IDE without any errors.It is also showing the output as given in tutorial. But when i check the values in the mysql database, the values ar 

hello sir
hi, When i try to run this example i am getting the following error log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Could not parse mapping document from r 

please help me
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NullPointerException at kalyan.hibernate.FirstExample.main(FirstExampl 

Hi Chris, your suggestion works!!!
Hi Chris, Thanks a lot for your suggestion.It did work!!! Still not sure, why we need to flush and then commit the connection. 

FIXED
to make this work you need to commit after the flush. session.connection().commit(); works fine after that. c.  

Solution for to insert a record
Hi, Since Hibernate is a persistence tool. It performs the operation in transactinal environment. Inorder to work the above code should me modified as. try{ // This step will read hibernate.cfg.xml and prepare hibernate for use S 

Hibernate
This page is very useful. 

help required
I am connecting to Oracle.its showing but the record is not getting inserted. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Hibernate: i 

i am getting the following error.
Cannot open connection Cannot open connection log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. 

insert
I think that the following 2 lines are needed to insert the data into the database. <b>Transaction tx=session.beginTransaction();</b> Contact contact = new Contact(); contact.setId(3); ... session.save(contact); <b>tx.commit();</b>  

The site is useful
This site is very useful. Right now i am looking for an Example on Hibernate+Spring, which will intract with Portals, which run inside Portal server, can any one help in in this issue. I want to develop an Basic application , which takes so 

need to place log properties
i think you need to place log.properties file application root directory. i resolved this by doing same thing  

Regarding Hibernate query
while I'm trying to get the session in the Hibernateprogram by using the below statement I'm executing this program in NetBeans5.0 and using the databaseserver is MySql4.1 SessionFactory sessionFactory = new Configuration().configure().buildSessi 

It is nice
This document is very useful 

Compilation Error
Hi I went through this tutorial but i am getting one error which is compilation error: please tell me why is it? I changed some code like this in FirstExample.java : ========================================== package net.roseindia.tutorial.hib 

Dialect
instead of "net.sf.hibernate.dialect.Oracle9Dialect" use "org.hibernate.dialect.MySQLDialect".. 

hibernate exception while insert DB record
exceeption while inserting the record into DB on hibernate. i am getting the following exception can anyone plz help me, thanks Hibernate: insert into events (name, amount, desc, id) values (?, ?, ?, ?) org.hibernate.exception.SQLGrammarExcept 

please solve this problem
I got the list from hql query.Now how can i print the value of each row of the table from the list object.If any one has the solution pls mail me. 

errors occured after running this program
og4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. 

Hiberate
problem occuring while parsing mapping file  

need help
I am connecting to Mysql.its showing but the record is not getting inserted. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Hiberna 

help me
am connecting to Mysql.its showing but the record is not getting inserted. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Hibernate: inse 

About Exception
log4j:WARN No appenders could be found for logger (roseindia.tutorial.hibernate.HibernateUtil). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.ExceptionInInitializerError at roseindia.tutorial.hiberna 

Could not find oracle dialect
Hi I am getting the following error can anybody help. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. java.lang.NullPointerException at roseindia.tutori 

reply for
Hi , you must be inserting the same value in the column which is primary key.  

first example running best but data not found
first example running best but data which I insert not found in the database although the table structure is build. Means shows table but with out any data. The console output is same as you shown  

when running the hibernet
when running the hibernet programe iam getting the NullPointer Exception.so please tell me why iam getting the exception. 

Hibernate
here Session is Hibernate Session so //SessionFactory sessionFactory = ((Object)new Configuration()).configure().buildSessionFactory(); Object SessionFactory; session = ((Object)SessionFactory).openSession(); above lines of code is wrong as  

BatchedTooManyRowsAffectedException
Hi, I am getting the below exception while running the program. The table structure is created though but no data is getting inserted to the table and then the exception. Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) value 

insert record-error
hello, I'm trying to use hte source code that is given, but then I got error log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Excep 

I like the basic help
i like the basic help and your way of Explenetion With Example. It helps me 

Creating a schema using Hibernate
Can i create an new schema(table) in my database using Hibernate provided i have my POJOs and mappings ready? 

about hibernate and pls solve this
Hi i am using sql server database and i am getting this output log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Hibernate: insert  

Hibernate 1 st Example Feedback
Hi, When I am trying to run this application. I am getting NullPointer Exception. Please give me the feedback. Regards, Sundararaman.V.S. 

Not updating data in database
Hi i am using sql server database and i am getting this output log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Hibernate: insert  

solving the prob
hi there is problem with url string which u r entering so let me know whic db u r using and db server m/c ip  

Mistake
It seems the guy who wrote this never tested it actually. Without the Transaction tx = session.beginTransaction() and tx.commit(), you will never get a row inserted into the db. If you give that, everything works fine.... To yolan, U have t 

new Configuration() giving error
Hi, i am trying standalone hibernate program,while excuting org.hibernate.cfg.Configuarion =new Configuration(); giving following error. Please any one can help me ASAP. Exception in thread "main" java.lang.ExceptionInInitializerError a 

Contact Data not getting inserted
I am also facing the same problem as Parvesh. The database is built with all the tables but Contact data is not getting inserted. Also there is no error. Can somebody help us? Thanks 

Transaction missing in FirstExample
I figured out the problem in FirstExample.java why it is not inserting into the database. The problem is there is no demarcation of Transaction. Please add following code appropriately. org.hibernate.Transaction tx = session.beginTransaction();  

DATA IS NOT UPDATING IN database,
DATA IS NOT UPDATING IN database, I have the same problem log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Hibernate: insert i 

help
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting Record Done Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot op 

error. Where Should I copy hibernate.cfg.xml
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. /hibernate.cfg.xml not found org.hibernate.HibernateException: /hibernate.cfg.xml not found at org.hiberna 

Exception in FirstExample Hibernate
Hi i m trying ur FirstExample But I m getting NumberFormatException java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at jav 

Data is not inserting into database
Data is not inserting to database  

log4j
you need log4j.properties file to be included to get rid of the log4j warnings....the code works fine..... 

very nice
this example, inserting data with wornings log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. 

getting log4j wrnings
Hi, i am, getting log4j errors when i am running above code could any body let me know why warning displaying.i am pasting those warnings here. log4j: no appenders could be found for logger(org.hibernate.cfg.environment) log4j: please initial 

promblem while running hibernate
when i run the program i am getting java.lang.noclassdeffound error and exception in thread main.please tell how to solve the promblem 

hybernet session
Why we are using sessionFactory,Session concepts in hybernet? 

test
test 

Solution for log4j problem.
If you get log4j error written below: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. /hibernate.cfg.xml not found Please add log4j.properties in the p 

Error : 503 SERVICE_UNAVAILABLE RequestURI=/ Power
Hi, I have created one application using hibernate with HSQL. I wanted to change it to MySQL. When I have changed my Hibernate.properties file but after changing the file i get the following error. HTTP ERROR: 503 SERVICE_UNAVAILABLE RequestU 

Shamema
In test.java please commit to data base which will be stored in contact Transaction tx=session.beginTransaction(); session.save(contact); tx.commit(); 

For not updating in database first Hibernate Examp
By commiting ur transaction ur problem may be solved SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session=sessionFactory.openSession(); Transaction tx=session.beginTransaction(); System.out.p 

Would be nice if I could see the article.
This might be a good article if there weren't annoying ads sitting in front of the text. What is the point of a site that can't be read???? 

DATA IS NOT UPDATING IN database,
Hi, I am new to hibernate concept, i did this example .but DATA IS NOT UPDATING IN database, I have the same problem log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j 

Resource not found
Hi, I receive the following error: Resource: ro/isd/db/t1.hbm.xml not found t1.hbm.xml is in same package as t1.java Please, help. 

Sessions
When is better place to close a session?. I mean, if I've a UserManager class, and I've: getById getByName ... Is convenient that I open a session for all methods into the constructor or open (and close) a session in each method? Best rega 

why this message is coming?
init: deps-jar: Compiling 1 source file to D:\java\HibernateDemo\build\classes compile: run: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Inserting R 

help reqd..
i ahve java,mysql,hibernate on my machine.. i have defined class structure.. have defined xml mapping.. have created hibernate.cfg.xml have created corresponding database now my manager is asking to create class object n then store it in DB. 

DATA IS NOT UPDATING IN database
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?) but data is not updating or inserting or updating into data base  

session.save is not inserting
Hi, I am trying out these examples and using in my code but the session.save(object) does not insert the object in the DB.Am not getting any errors or exceptions here is a snippet of the console stdout : ********insert Start for test********8 g 

Plz add Transaction statement in FirstExample.java
Hello RoseIndia Team / Deepak Kumar, Please include begin transaction and commit transaction statements in FirstExample.java to save the data in the database. --------------------------------------------- SessionFactory sessionFactory = new Con 

error crating the project
hi i'm trying to do the firstexample of hybernate.but i'm recieving the message as follows Inserting Record Hibernate: insert into CONTACT (FNAME, LNAME, EMAIL) values (?, ?, ?) Done data is not inserted in to record..and no error or exc 

problem in Microsoft SQL Server
i am using Microsoft SQL Server. and i m getting a error that JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQLServerDriver. can anybody help me out 

jsf query
i am new to hibernate so whats ur advice .... what are the thinks that i hav to know before starting hibernate ..which IDE supports hibernate .. pls advice....... 

error
hi all. i m new with hibernet.......when i m trying to run my first application i m getting following exceptio. Exception in thread "main" java.lang.NullPointerException at com.FirstExample.main(FirstExample.java:33). i have deployed all the jar 

NullPointerException
While Iam running the First Example..I am getting NullPointer Exception...Any one can help me in Ths Regards... Thanks In Advance.. SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); System.out.println(" 

hibernate
how to retrive data from a database 

Good Article
I am able to run the application with the help of this article using orcle11g database.. And also i found the same article with more details on the below given link. http://www.javajazzup.com/issue6/page34.shtml Thanks for the article.  

plzzz respond
Hi all. i m new with hibernet.......when i m trying to run my first application i m getting following exceptio. Exception in thread "main" java.lang.NullPointerException at com.FirstExample.main(FirstExample.java:33). 

net.sf.hibernate.MappingException: Error reading
Hi, Based on the example given , I'm trying to run my application using Hibernate 2.1. But I'm getting exception net.sf.hibernate.MappingException : Error reading Resource Employee.hbm.xml. I have my hibernate.cfg.xml and Employee.hbm.xml in p 

exception in firstexample in hibernate
hell sir when i am executing the FirstExample in struts it is showing nullpointer exception..can you give the solution for this.. 

org.hibernate.cfg.Environment)
hi.... I use the above code to run my project but it showed me following error: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. entity class not found: Student 

Add all jar files..
If you r a beginer then plz do not forget to add c:\hibernate-3.2\lib\*.jar files to your class path variable. Otherwise Main method will how errors. 

request
what to write in the Driver name if we are using Oracle database 

Error
While i am running the FirstExample.java file runas javaApplication it is showing Dialect class not found: java.lang.NullPointerException at src.com.FirstExample.main(FirstExample.java:29) Exception in thread "main" Error.so how can i solv 

Error while running the above code
Hello, I am using NetBeans IDE and while I was trying to run the above code, I got the following error. ------------------------------------------------- log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WAR 

Programmer
Make slight modification to code to insert data into DB.Otherwise it will only be in session. In FirstExample.java Contact contact = new Contact(); contact.setId(3); contact.setFirstName("Deepak"); contact.se 

Option type out of range ??
Hibernate: insert into MyBook (bookName, bookAuthor, bookId) values (?, ?, ?) java.sql.SQLException: [Microsoft][ODBC Driver Manager] Option type out of range what does it mean? 

Unhandled exception : nullpointer
Im runing this example in my struts application .., when it reach this line , im getting nullpointer exception .., pls help me out of this.. SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); [8/12/08 1 

hibernate error
i'm using netbean 6.1 but when it run it have error com.mysql.jdbc.Driver not found.I see com.mysql.jdbc.Driver is installed width hibernate. Why i have this problem?  

Not Updating Data In Database, Hibernate Firstexam
I have same problem. 

npe
to the dudes having NPE - additional libraries are required: antlr-2.7.6.jar,commons-collections-3.1.jar,commons-logging.jar,dom4j-1.6.1.jar,javassist-3.4.GA.jar,jta-1.1.jar,slf4j-api-1.5.3.jar,slf4j-jcl-1.5.3.jar see hibernate distribution 

comment
hi, I study your web, in that ejb,Hibernate it gives very detail with sutable example, architecture and brief description so it is very easy to understand.......... Thanks..... Dnyaneshwar S.  

Try this for inserting
I too faced this problem and solved it like this u need to add the following lines session = sessionFactory.openSession(); -------------------------------------------- Transaction txn = session.beginTransaction(); ------------------------------ 

Help Me...
I also finds the same problem... Exception in thread "main" java.lang.NullPointerException  

NullPointerException
hi when i am running this example then i am getting nullpointer exception like "Exception in thread "main" java.lang.NullPointerException" ..please anyone help me  

NullPointerException
hi , can anyone help me out , when i run the FirstExample.java file then i am getting an error as " Exception in thread main , java.lang.NullPointerException". 

Hibernate code problem
when i was executing the code FirstExample.java i am getting NULL POINTER EXCEPTION at the line session.flush(). can anybody helps me in solving this problem..... 

exception
Exception in thread "main" java.lang.NullPointerException at pack.FirstExample.main(FirstExample.java:41)  

No insertion
NO INSERTION HAPPENS!! System.out.println("Inserting Record"); Contact contact = new Contact(); contact.setId(6); contact.setFirstName("Deepak"); contact.setLastName("Kumar"); contact.setEmail("deepak"); session.save( 

Problem with Hibernate example
Hi, I am trying run the firstexample of hybernate.I got the follwing problems. <property name="firstName"> <column name="FIRSTNAME"/> </property> If i use the above code in the xml, i got The content of element type "property" must mat 

hibernate
it is good but tell me more details of the each and every line of the first xml codind 

hi
when i was executing the code iam geting following Exception in thread "main" java.lang.NullPointerException at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:42) any one plz help 

hibernate baisc example programs
i need more basic examples programs on hibernate. 

Getting exception
hi when i am running this example then i am getting nullpointer exception like "Exception in thread "main" java.lang.NullPointerException" ..please anyone help me  

Regarding NPE
Hi, Inspite of having all the below jars in the classpath, antlr-2.7.6.jar, commons-collections-3.1.jar, commons-logging-1.0.jar, dom4j-1.6.1.jar, javassist-3.4.GA.jar, jta-1.1.jar, slf4j-api-1.5.3.jar, slf4j-jcl-1.5.3.jar I am still  

GUD WORK
THANKS GUYS .... KEEP POSTING :) 

Hibernate
Thanks for the example given on hibernate but when i was executing the code iam geting following Exception in thread "main" java.lang.NullPointerException at Hibernate.FirstExample.main(FirstExample.java:34) 

Exception in thread "main" java.lang.NullPointerEx
what to do if problem is in session.i need to add any jar files to the classpath 

Problem in this "FirstExample" class
There is a problem. In this "FirstExample" class session =sessionFactory.openSession(); //Create new instance of Contact and set //Here transaction should begin. Transaction trx = session.beginTransaction(); values in it by r 

Suggestion
After session.save(contact); add session.beginTransaction().commit(); or session.connection().commit(); I think it will solve ur problem 

java hibernaate
this is excelent thanks for this  

Running testclient from eclipse, getting error
[org.hibernate.cfg.Configuration] : Preparing to build session factory with filters : {} [org.hibernate.cfg.Configuration] : processing extends queue [org.hibernate.cfg.Configuration] : processing collection mappings [org.hibernate.cfg.Configurati 

Hibernate First Example
First Example 

Java
This is definitely beneficial, it provides clear sample codes of how Java could be used to build applications 

hibernate in french
I need to have the lesson about hibernate in a french version. 

Comment on hibernate example
It is really helpful. I would like to know how to use oracle10g insted of MYSQL 

Data not getting inserted........
Change the FisrtExample.java file as import org.hibernate.Transaction;//added Contact contact = new Contact(); Transaction tx = session.beginTransaction();//added contact.setId(3); contact.setFirstName("Deepak"); Syst 

Hibernate Dialect must be explicitly set
HI, After compiling this i am getting in the fallowing way "Hibernate Dialect must be explicitly set" looking for comment  

error
hi, when compile FirstExample.java class i am getting the following error Exception in thread "main" java.lang.NullPointerException at FirstExample.main(FirstExample.java:30)  

jar problem
Which jars are required for hibernate? 

jar files
Which jar files are required to run the above code?  

Core interface Transaction stuff has been missed
Hi, Core interface Transaction stuff has been missed out in FirstExample.java program. After Session object initialization, org.hibernate.Transaction tx = null; After opening the session tx = session.beginTransaction(); Before fulshing  

THANX!
I would like to tell the webmaster "thank you!" because every time I'm trying using a framework for the first time and need an example the better and clearer explanation I always find here (among all examples I found in the Internet the only one's wo 

Excellent example
I like the example and followed the entire thread. I am able to run my first hibernate application. Kudos !! 

Hibernate
It is very easy to learn the hibernate with ina less span of time and very helpful for understanding the concept clearly. Thanks for roseindia.net  

Hibernate
It is very easy to learn the hibernate with ina less span of time and very helpful for understanding the concept clearly. Thanks for roseindia.net  

Nice Tutorial on Hibenate
Thanks for such nice tutorial.. It is really a good example to start with Hibernate. but unfortunately this code contains one bug. I had tried to run this demo, but it won't work due to one missing sentence. To insert data in database you  

Set the property hibernate.dialect
I too get the same exception. could any1 please explain on this Thanks 

Learning example
good example to start the hibernate learning 

Answer of ur question
Set property name="dialect" org.hibernate.dialect.OracleDialect. After that ur code will work. <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>  

Thanks.
Thanks Mahesh..!! 

good
it is very helpful.nice example. 

NO INSERTION ??
hi, when I implement an example like the this one(FirstExample.java), it does not insert anything, also does not give any error or warning. Does anybody have an idea where I am doing wrong ?? 

Please correct the above example
Please correct the above example/ This wont work as its not bound to a Hibernate transaction. I copy pasted the code and evrything worked fine till I queried the DB there are no inserts happening if you runit. I found that code is missing sesi 

How to disable refresh button in menubar
I alredy tried with window.open.. Using stryts class how to disable the refresh button Also how to hide the url in address bar in struts platform 

Hibernate
Looks Great! and simple to understand the concept 

Can I do multiple inserts within same session / tr
Can I do multiple inserts within same session / transaction? But it was failed for me. See the example below : SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); org.h 

Null pointer exception
I am getting null pointer exception at SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Can anyone help me? 

hibernate
Session ses=new Configuration().configure("/hibernate cfg file").buildSessionfactory().openSession this code will slove your problem 

hibernate inseration
u have to enable transactions for non select opreations like update delete,insert operations see the code below System.out.println("Inserting Record"); Transaction tx=session.openTransaction() Contact contact = new Contact(); contact.setId(6);  

Problem Inserting Data
Here in the above example you did not use Transaction. But i could not insert data without using Transaction interface. I used directly session.save() without using Transaction, but i could not insert the record.  

Hibernate file missing in java code
Hi , In the class FirstExample ,I dont see that we are passing any reference of hibernate.cfg.xml then how will the code knows what file to load and where to find it . I am new to hibernate and I have never seen any code in java where we  

not open the connection in data base
i am new to hibernate. when i used to execute this program it shows inserting record and cannot open connection and shows (Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection)  

java code
nullpointerexception 

STRING
i m getting NULL POINTER EXCEPTION when a empty string is passed to a method.i m using NETBEANS IDE6.5. can anyone help me? 

FirstExample Problem
Upon running the code in the First example. I keep getting the session object as null. How to overcome this?  

Null Pointer Exception, Hibernate Firstexample
do you have hibernate.cfg.xml in the classpath. 

It works fine
Add the following line session.beginTransaction().commit(); after session.save(contact); 

null pointer exception
check your finally clause if there is no session yet you can't flush() nor close() it. Make that finally clause: if (session != null) { session.flush(); session.close(); } if you write directly finally clause like finally{ sessi 

correction in FirstExample.java
add these:- import org.hibernate.Transaction; then before S.o.p("Inserting records") add the below:- Transaction tx = session.beginTransaction(); then after S.o.p("Done"); add:- tx.commit(); when ever u insert anything to DB u must commit 

FirstExample.java correction
add these:- import org.hibernate.Transaction; then before S.o.p("Inserting records") add the below:- Transaction tx = session.beginTransaction(); then after S.o.p("Done"); add:- tx.commit(); when ever u insert anything to DB u must commit 

Problem in running sample Hibernate code
Im new to this hibernate. When i try to run the FirstExample.java class im getting the followning error ::: Cannot open connection I have change my hibernate.cfg.xml file as like this :: <hibernate-configuration> <session-factory>  

Assistant Professor
session.beginTransaction().commit(); Add this after session.save(contact); it will work 

no insertion
may be this enty helps <property name="connection.autocommit">true</property>  

Correct code to run first programme of hibernate
package roseindia.tutorial.hibernate; import java.io.Serializable; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; /** * @author Gunjan Kum 

Hibernate
when i execute the program i am getting null pointer exception.i didn't create any database...can u pls help me..i am new in hiberate..please 

Exception in thread "main" org.hibernate.Hibernate
Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set No one had given proper answer to resolve this error 

very good to learn
This site contians lot of programming stuff that helps developers and students. 

NoClassDefFoundError
After using Transaction tx=session.beginTransaction(); tx.commit(); Still the same prob exists. plz tel a solution Exception in thread "main" java.lang.NoClassDefFoundError: FirstExample (wrong n ame: roseindia/tutorial/hibernate/FirstExample)  

error
After building nad running I get the following error Exception in thread "main" java.lang.NoClassDefFoundError: roseindia/tutorial/hibernate/FirstExample Caused by: java.lang.ClassNotFoundException: roseindia.tutorial.hibernate.FirstExample at j 

Could not Parse Error
I am getting the following error, when i try to run a sample application, could you please let me know, what should have happened wrong....? Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping docu 

error
i see nullpointer exception at session 

inform a coding mistake.
In this page we can't run this first Hibenate code example.Because of FirstExample.java class must have following two statements in the main method. org.hibernate.Transaction tx = session.beginTransaction(); tx.commit(); please correct  

Need to add transaction
Please add the below lines. Transaction tx=session.beginTransaction() tx.begin(); Before session.save() and tx.commit(); after it. This should work :) 

error
how to solve the error reading resource in insurance .hbm.xml files in association and join example. please reply me it is very urgent. no one has posted the proper answer . your tutorial is really good i am new to hibernate but now i am able t 

java j2ee hibernate spring
This examples and explanation is very good . 

hibernet first example
every thing is very basic and easily understable. but dint mention how and where to create new .hbm.xml ? 

good one ton start with
This tutorial is very much useful for any beginner who wants to excel conceptuaaly and practically in hibernate .It covers every thing to learn and understand hibernate. 

Changes in the above Code
session =sessionFactory.openSession(); //Create new instance of Contact and set values in it by reading them from form object System.out.println("Inserting Record"); Contact contact = new Contact(); contact.se 

Right code
here is the code that works! public static void main(String[] args) { // TODO code application logic here Session session = null; try{ // This step will read hibernate.cfg.xml System.out.println("creating 

Hibernate First Example.
After adding the Tranasaction part, the code works perfectly fine by adding the records into the database. Thanks for a very good tutorial for the beginners. 

hibernate
this site gives very good information.... 

hybernate
how i can learn this topic 

Little improvemnet
Very very thanks for providing such a useful coding . b'cause of you only we can understand the new technology throughly. plz try to give step 1 step2 ..like so very novice programmer also can understand about configuration 

content missing
please add the two line in hibernate first exemple ok Transaction tx=session.beginTransaction(); tx.commit(); 

Bug in above code
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session =sessionFactory.openSession(); // The below transaction element is not initialized and commited Transaction trans = session.beginTransaction 

Exception
Could not get the result when executing hibernate first example: pls help me Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConve 

hi
I Try to write this tutorial and in my eclipse console white this: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang 

HibernateExample with Oracle Database
The FirstExample is not working when u use oracle database.so u need to add those two more lines in the program i.e. tx = session.beginTransaction(); before Contact contact = new Contact(); and tx.commit(); after session.save(contact); 

try this
roseindia/tutorial/hibernate/FirstExample do u have ur java class in this path? if not create it or else change the path according to your java class file path 

How to Display Flags along with Country names
hai this is my comment  

Request
The tutorial you provided is excellent but if you provide the space that where to put hibernate.cfg.xml & contact.hbm.xml then it will be more useful for us thank you  

Related Tutorial and Articles
Hibernate Questions

hibernate firstexample - Hibernate
hibernate firstexample  Hi all. i m new with hibernate,when i m trying to run my first application i m getting following exception. Error reading resource: Employee.hbm.xml give me the solution. Thank you 

Hibernate Questions

hibernate firstExample not inserting data - Hibernate
hibernate firstExample not inserting data  hello all , i followed... in the firstExample as below. I will later post the actual code issue later. here i am... for more information. http://www.roseindia.net/hibernate/ Thanks.  

Java Tips and Examples

New to Java?
New to Java?       If you are new to Java technology and you want to learn Java and make career in the Java technology then this page is for you. Here we have explained how to learn 

Hibernate Interview Questions

What is hibernate technology in java?
What is hibernate technology in java?  What is hibernate technology in java?   Hibernate: -Hibernate is an Open Source persistence technology. It provides Object/Relational mapping library. It solves object-relational 

Hibernate Questions

hi i m new to hibernate..plzzzzzzzzzzzzzz help me.... - Hibernate
hi i m new to hibernate..plzzzzzzzzzzzzzz help me....  hi friends i m new to hibernate..& i m stuck in one positon in my pgm.. its a simple select... and prepare hibernate for use SessionFactory sessionFactory = new Configuration 

Programming Tutorials

New Page 1
that help you in understanding JavaScript loop through. We are using Java Script... i ,followed by a break line, again the for loop execute and run the script  after comparing  variable i and variable j in the loop and print 

JSP Servlet Questions

new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType...; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import 

Struts Questions

Hi i am new to J2ee Technology and struts - Struts
Hi i am new to J2ee Technology and struts  what exatly will happen when we hit the Login button? Once we enter in to the application, what will happen. How the UserID and Password validations will done. Can any one help 

Hibernate Questions

Java - Hibernate
Java  friends plz help me. when i run hybernate program i got, this type of output. ---------------------------- Inserting Record Done Hibernate... FirstExample { public static void main(String[] args) { Session session = null 

Java Beginners

Courses in Information Technology
you in becoming a good programmer. You may learn: a) Core Java b) Advance Java c) Hibernate d) Spring e) Database programming See IT Training page for more... in Information Technology for beginner? How to learn programming and become a good programmer 

Advertisements Advertisements
 

 

 

DMCA.com