-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Cannot persist a class with protected accessor methods
PostPosted: Wed Dec 22, 2004 11:46 pm 
Newbie

Joined: Mon Dec 20, 2004 9:08 pm
Posts: 9
Hibernate version:
2.1.7c
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="com.orchestral.cdr.element.NextOfKin">

<id name="id" type="int" unsaved-value="null">
<column name="id"/>
<generator class="hilo"/>
</id>

<!-- Properties of NextOfKin object -->
<property name="setID"/>
<property name="nameString"/>
<property name="addressString"/>
<property name="homePhoneNumberString" column="homePhoneNumString"/>
<property name="businessPhoneNumberString" column="businessPhoneNumString"/>
<property name="startDate"/>
<property name="endDate"/>
<property name="jobTitle"/>
<property name="jobCode"/>
<property name="jobClass"/>
<property name="organisationName" column="orgName"/>
<property name="organisationNameTypeCode" column="orgNameTypeCode"/>
<property name="organisationNameRepresentationCode" column="orgNameRepCode"/>
<property name="organisationString" column="orgString"/>
<property name="sex"/>

<component name="dateOfBirth" class="com.orchestral.common.date.PartialDate">
<property name="timestamp" column="dateOfBirth"/>
<property name="precisionChar" column="dateOfBirthPrec"/>
<property name="nanoseconds" column="dateOfBirthNano"/>
</component>

</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
[ERROR] (hibernate.cfg.Configuration ) - Could not compile the mapping document
net.sf.hibernate.MappingException: Problem trying to set property type by reflection
at net.sf.hibernate.mapping.SimpleValue.setTypeByReflection(SimpleValue.java:183)
at net.sf.hibernate.cfg.Binder.createProperty(Binder.java:1069)
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:870)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1053)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:363)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1257)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1018)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:974)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
at com.orchestral.cdr.CDRDBBaseImpl.<init>(CDRDBBaseImpl.java:93)
at com.orchestral.cdr.CDRLoaderTest.<init>(CDRLoaderTest.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:102)
at junit.framework.TestSuite.<init>(TestSuite.java:66)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:360)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:398)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Caused by: net.sf.hibernate.PropertyNotFoundException: field not found: timestamp
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:74)
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:80)
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:80)
at net.sf.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:88)
at net.sf.hibernate.util.ReflectHelper.getter(ReflectHelper.java:81)
at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:86)
at net.sf.hibernate.mapping.SimpleValue.setTypeByReflection(SimpleValue.java:172)
... 24 more

Name and version of the database you are using:
SQl Server 2000
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
[ INFO] (hibernate.cfg.Binder ) - Mapping class: com.orchestral.cdr.element.NextOfKin -> NextOfKin
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: id -> id, type: integer
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: setID -> setID, type: integer
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: nameString -> nameString, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: addressString -> addressString, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: homePhoneNumberString -> homePhoneNumString, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: businessPhoneNumberString -> businessPhoneNumString, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: startDate -> startDate, type: timestamp
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: endDate -> endDate, type: timestamp
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: jobTitle -> jobTitle, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: jobCode -> jobCode, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: jobClass -> jobClass, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: organisationName -> orgName, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: organisationNameTypeCode -> orgNameTypeCode, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: organisationNameRepresentationCode -> orgNameRepCode, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: organisationString -> orgString, type: string
[DEBUG] (hibernate.cfg.Binder ) - Mapped property: sex -> sex, type: string
[ERROR] (hibernate.cfg.Configuration ) - Could not compile the mapping document
net.sf.hibernate.MappingException: Problem trying to set property type by reflection
at net.sf.hibernate.mapping.SimpleValue.setTypeByReflection(SimpleValue.java:183)
at net.sf.hibernate.cfg.Binder.createProperty(Binder.java:1069)
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:870)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1053)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:363)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1257)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1018)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:974)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
at com.orchestral.cdr.CDRDBBaseImpl.<init>(CDRDBBaseImpl.java:93)
at com.orchestral.cdr.CDRLoaderTest.<init>(CDRLoaderTest.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:102)
at junit.framework.TestSuite.<init>(TestSuite.java:66)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:360)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:398)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Caused by: net.sf.hibernate.PropertyNotFoundException: field not found: timestamp
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:74)
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:80)
at net.sf.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:80)
at net.sf.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:88)
at net.sf.hibernate.util.ReflectHelper.getter(ReflectHelper.java:81)
at net.sf.hibernate.util.ReflectHelper.reflectedPropertyType(ReflectHelper.java:86)
at net.sf.hibernate.mapping.SimpleValue.setTypeByReflection(SimpleValue.java:172)
... 24 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 23, 2004 9:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Posting once is enough. See the other thread you posted.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.