• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Could not find a getter for id1 in class ........

 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am getting following exception while executing

at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
Caused by: org.dom4j.DocumentException: Error on line 23 of document : Expected
"</hibernate-mapping>" to terminate element starting on line 5. Nested exceptio
n: Expected "</hibernate-mapping>" to terminate element starting on line 5.
at org.dom4j.io.SAXReader.read(SAXReader.java:355)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
... 8 more
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.reddy.Util.<clinit>(Util.java:12)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
Caused by: net.sf.hibernate.MappingException: Error on line 23 of document : Ex
pected "</hibernate-mapping>" to terminate element starting on line 5. Nested ex
ception: Expected "</hibernate-mapping>" to terminate element starting on line 5
.
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
260)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
... 2 more
Caused by: org.dom4j.DocumentException: Error on line 23 of document : Expected
"</hibernate-mapping>" to terminate element starting on line 5. Nested exceptio
n: Expected "</hibernate-mapping>" to terminate element starting on line 5.
at org.dom4j.io.SAXReader.read(SAXReader.java:355)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
... 8 more

D:\hibernate>java com.reddy.EventManager person
EventPerson:----->10
EventPerson:----->12222
Nov 3, 2005 2:18:31 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.0.3
Nov 3, 2005 2:18:31 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Nov 3, 2005 2:18:31 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Nov 3, 2005 2:18:31 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: JVM proxy support: true
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Configuration getConfigurationInputS
tream
INFO: Configuration resource: /hibernate.cfg.xml
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Review.hbm.xml
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.reddy.EventPerson -> EVENTS_PERSON
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Configuration configure
INFO: Configured SessionFactory: null
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Nov 3, 2005 2:18:32 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Nov 3, 2005 2:18:32 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 3, 2005 2:18:32 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.OracleDialect
Nov 3, 2005 2:18:32 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: Hibernate connection pool size: 20
Nov 3, 2005 2:18:32 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc racle:thin:@17
2.16.1.227:1521:CFMC
Nov 3, 2005 2:18:32 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: connection properties: {user=CRS, password=CRS}
Nov 3, 2005 2:18:32 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use outer join fetching: false
Nov 3, 2005 2:18:33 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use scrollable result sets: true
Nov 3, 2005 2:18:33 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: JDBC 2 max batch size: 20
Event id ...> null
Nov 3, 2005 2:18:33 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInst
ance
INFO: no JDNI name configured
Nov 3, 2005 2:18:33 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Query language substitutions: {}
EventPerson:----->11111111net.sf.hibernate.impl.SessionImpl@189c036
EventPerson:----->2net.sf.hibernate.transaction.JDBCTransaction@458f41
EventPerson:----->3com.reddy.EventPerson@c01e99
Event id ...> This is kanth
EventPerson:----->3This is kanth
Event id ...> This is kanth
EventPerson idddddddddd:----->1
Event id ...> This is kanth
EventPerson:----->11
Nov 3, 2005 2:18:34 PM net.sf.hibernate.impl.SessionFactoryImpl close
INFO: closing
Nov 3, 2005 2:18:34 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er close
INFO: cleaning up connection pool: jdbc racle:thin:@172.16.1.227:1521:CFMC

D:\hibernate>java com.reddy.EventManager person
EventPerson:----->10
EventPerson:----->12222
Nov 3, 2005 2:18:53 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.0.3
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: JVM proxy support: true
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Configuration getConfigurationInputS
tream
INFO: Configuration resource: /hibernate.cfg.xml
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Review.hbm.xml
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.reddy.EventPerson -> EVENTS_PERSON
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Configuration configure
INFO: Configured SessionFactory: null
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Nov 3, 2005 2:18:54 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Nov 3, 2005 2:18:54 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 3, 2005 2:18:54 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.OracleDialect
Nov 3, 2005 2:18:54 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: Hibernate connection pool size: 20
Nov 3, 2005 2:18:54 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc racle:thin:@17
2.16.1.227:1521:CFMC
Nov 3, 2005 2:18:54 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er configure
INFO: connection properties: {user=CRS, password=CRS}
Nov 3, 2005 2:18:54 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use outer join fetching: false
Nov 3, 2005 2:18:55 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use scrollable result sets: true
Nov 3, 2005 2:18:55 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: JDBC 2 max batch size: 20
Event id ...> null
Nov 3, 2005 2:18:55 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInst
ance
INFO: no JDNI name configured
Nov 3, 2005 2:18:55 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Query language substitutions: {}
EventPerson:----->11111111net.sf.hibernate.impl.SessionImpl@189c036
EventPerson:----->2net.sf.hibernate.transaction.JDBCTransaction@458f41
EventPerson:----->3com.reddy.EventPerson@c01e99
Event id ...> This is kanth
EventPerson:----->3This is kanth
Event id ...> This is kanth
EventPerson idddddddddd:----->2
Event id ...> This is kanth
EventPerson:----->11
Nov 3, 2005 2:18:56 PM net.sf.hibernate.impl.SessionFactoryImpl close
INFO: closing
Nov 3, 2005 2:18:56 PM net.sf.hibernate.connection.DriverManagerConnectionProvid
er close
INFO: cleaning up connection pool: jdbc racle:thin:@172.16.1.227:1521:CFMC



Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.0.3
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: JVM proxy support: true
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Configuration getConfigurationInputS
tream
INFO: Configuration resource: /hibernate.cfg.xml
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Review.hbm.xml
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.reddy.Event -> EVENTS
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Configuration add
SEVERE: Could not compile the mapping document
net.sf.hibernate.PropertyNotFoundException: Could not find a getter for id1 in c
lass com.reddy.Event
at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206)

at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelp
er.java:260)
at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:225)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
rethrown as net.sf.hibernate.MappingException: Problem trying to set property ty
pe by reflection: Could not find a getter for id1 in class com.reddy.Event
at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:103)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:225)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:838)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
Caused by: net.sf.hibernate.PropertyNotFoundException: Could not find a getter f
or id1 in class com.reddy.Event
at net.sf.hibernate.util.ReflectHelper.getGetter(ReflectHelper.java:206)

at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelp
er.java:260)
at net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:92)
... 12 more
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Review.hbm.xml
Nov 3, 2005 2:19:53 PM net.sf.hibernate.cfg.Configuration add
SEVERE: Could not compile the mapping document
net.sf.hibernate.MappingException: duplicate import: Event
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
net.sf.hibernate.MappingException: duplicate import: Event
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.reddy.Util.<clinit>(Util.java:12)
at com.reddy.EventManager.createPerson(EventManager.java:49)
at com.reddy.EventManager.main(EventManager.java:23)
Caused by: net.sf.hibernate.MappingException: duplicate import: Event
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273
)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
at com.reddy.Util.<clinit>(Util.java:9)
... 2 more


this is the xml written can any body tell us where i did mistake



<hibernate-mapping>
<class name="com.reddy.Event" table="EVENTS">
<id name="id1" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
<class name="com.reddy.EventPerson" table="EVENTS_PERSON">
<id name="id" column="PERSON_ID">
<generator class="increment"/>
</id>
<property name="title" column="EVENT_ID"/>
</class>
</hibernate-mapping>


Event class have setter and getter methods.
at the same time EventPerson also have setter and getter methods.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what is the code look like for the Event and other class.

Mark
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reposting your XML formatted. I tried to edit yours but > and < always get changed to HTML equivalents/



Mark
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic