-->
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: One-to-many relationship causes "Could not find a gette
PostPosted: Tue Sep 26, 2006 1:05 pm 
Newbie

Joined: Tue Sep 26, 2006 12:44 pm
Posts: 2
Location: Colorado Springs, CO USA
I've used the Hibernate reverse engineering tool to generate mappings and java code for an existing underlying database (schema cannot be changed) but when I attempt to load the HAR archive on my JBOSS server I get:

2006-09-26 10:32:57,619 DEBUG [org.hibernate.jmx.HibernateServiceMBean] Error was
org.hibernate.PropertyNotFoundException: Could not find a getter for parentDocument in class com.sugarcrm.DocumentRevisions
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)

I have been banging my head against the wall here - I googled for anything related to this error but have only found posts about the lettering convensions for JavaBeans (ie: dont use aBa for a name) which does not apply here. I have tried writing the hbm.xml file manually and get the exact same results... gahh!

The underlying database does not have any relationships between tables defined, this appears to be due to the design of the business layer (PHP based).

Hibernate version:
3.2.0.cr2 (via JBOSS 4.0.4.GA

Mapping documents:
--- DocumentRevisions.hbm.xml ---
<hibernate-mapping>
<class name="com.sugarcrm.DocumentRevisions" table="document_revisions" catalog="sugarcrm">
<comment></comment>
<id name="id" type="string">
<column name="id" length="36" />
<generator class="assigned" />
</id>
<many-to-one name="parentDocument" class="com.sugarcrm.Documents" fetch="select">
<column name="document_id" length="36">
<comment></comment>
</column>
</many-to-one>
</class>
</hibernate-mapping>

--- Documents.hbm.xml ---
<hibernate-mapping>
<class name="com.sugarcrm.Documents" table="documents" catalog="sugarcrm">
<comment></comment>
<id name="id" type="string">
<column name="id" length="36" />
<generator class="assigned" />
</id>
<many-to-one name="documentRevisions" class="com.sugarcrm.DocumentRevisions" fetch="select">
<column name="document_revision_id" length="36">
<comment></comment>
</column>
</many-to-one>
<set name="allRevisions" inverse="true">
<key>
<column name="document_id" length="36">
<comment></comment>
</column>
</key>
<one-to-many class="com.sugarcrm.DocumentRevisions" />
</set>
</class>
</hibernate-mapping>

--- Documents.java ---
public class Documents implements java.io.Serializable {

private String id;

private DocumentRevisions documentRevisions;

private Set allRevisions = new HashSet(0);

public String getId() { return this.id; }

public void setId(String id) {this.id = id;}

public DocumentRevisions getDocumentRevisions() {return this.documentRevisions; }

public void setDocumentRevisions(DocumentRevisions documentRevisions) {this.documentRevisions = documentRevisions; }

public Set getAllRevisions() {return this.allRevisions; }

public void setAllRevisions(Set allRevisions) { this.allRevisions = allRevisions; }

}


Code between sessionFactory.openSession() and session.close():
None - this is a JBOSS .HAR archive using the hibername mbean

Full stack trace of any exception that occurs:
2006-09-26 10:32:57,618 INFO [org.hibernate.jmx.HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using client classpath: Could not find a getter for parentDocument in class com.sugarcrm.DocumentRevisions
2006-09-26 10:32:57,619 DEBUG [org.hibernate.jmx.HibernateServiceMBean] Error was
org.hibernate.PropertyNotFoundException: Could not find a getter for parentDocument in class com.sugarcrm.DocumentRevisions
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:260)
at org.hibernate.tuple.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:238)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:121)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:50)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:256)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:418)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
at org.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:64)
at org.hibernate.jmx.HibernateService.start(HibernateService.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:995)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)


Name and version of the database you are using:
MySQL 4.1.14


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 1:08 pm 
Newbie

Joined: Tue Sep 26, 2006 12:44 pm
Posts: 2
Location: Colorado Springs, CO USA
Oops - forgot the code for DocumentRevisions:


public class DocumentRevisions implements java.io.Serializable {

private String id;
private Documents parentDocument;
private Set documentses = new HashSet(0);

public String getId() { return this.id; }

public void setId(String id) { this.id = id; }

public Documents getParentDocument() { return this.parentDocument; }

public void setParentDocument(Documents parentDocument) { this.parentDocument = parentDocument; }

public Set getDocumentses() { return this.documentses;}

public void setDocumentses(Set documentses) { this.documentses = documentses; }

}


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.