Hi All,
I am new to the Hibernate . I am trying some coding in it. Finally it ends up with exception which i am not able to resolve it so i need your help . i am pastin you with all the code please find out where i am making the mistake as i am unable to
The First thing in hibernate which i have make is a pojo class name Person.java file
Person.java
after that i have copied the hibernate.cfg.xml into my src folder
hibernate.cfg.xml
where i have changed all the necessary fields
then
i have copied the Person.hbm.xml file into my package com.bika
changes the necessary fields
Person.hbm.xml
afterdone it all i finally write the Manager.java class to insert or to do the ORM operation
color=red]Manager.java[ [/color]
as it it is successfully inserted in db but while retrieving the data in console i have written another
java class named Manager1.java but getting Exception
Manager1.java
and the exception as follows
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
.....Manager1...
1
Hibernate: select person0_.PERSON_ID as PERSON1_0_0_, person0_.firstName as firstName0_0_, person0_.lastName as lastName0_0_, person0_.age as age0_0_ from PERSON person0_ where person0_.PERSON_ID=?
Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.bika.Person#1]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:419)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:154)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:143)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at com.bika.Person_$$_javassist_0.getFirstName(Person_$$_javassist_0.java)
at com.bika.Manager1.main(Manager1.java:23)
can any body please help whats the flaws i am going through
I will really greatful to you all
Thanks in advance