-->
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: Class column variable always null
PostPosted: Thu Jan 19, 2006 6:27 pm 
Beginner
Beginner

Joined: Wed Nov 02, 2005 3:29 pm
Posts: 20
For some reason when I retrieve an NcContact record,
the orgUnitIdAndorgUnitType is always null rather than
having an NcOrgUnit assigned to it. The log shows that the
values for the column is being retrieved properly but for some
reason Hibernate is hiding the values from me.


Any ideas?

George

Hibernate version:
3.1

Mapping documents:
Generated by hibernate-tools 3.1 beta 3

<hibernate-mapping>
<class name="ca.ubc.nmc.contacts.db.NcContact" table="NC_CONTACT">
<id name="contactId" type="long">
<column name="CONTACT_ID" precision="10" scale="0" />
<generator class="ca.ubc.nmc.contacts.ContactIdGenerator"></generator>
</id>
<many-to-one name="role" class="ca.ubc.nmc.contacts.db.NcRoleTypeTbl" fetch="select">
<column name="ROLE" length="4" />
</many-to-one>
<many-to-one name="orgUnitIdAndorgUnitType" class="ca.ubc.nmc.contacts.db.NcOrgUnit" fetch="select">
<column name="ORG_UNIT_ID" length="10" />
<column name="ORG_UNIT_TYPE" length="4" />
</many-to-one>
<many-to-one name="classificationCde" class="ca.ubc.nmc.contacts.db.NcClassifTypeTbl" fetch="select">
<column name="CLASSIFICATION_CDE" length="4" not-null="true" />
</many-to-one>
<many-to-one name="lastUpdtBy" class="ca.ubc.nmc.contacts.db.NcContact" fetch="select">
<column name="LAST_UPDT_BY" precision="10" scale="0" not-null="true" />
</many-to-one>
<property name="nameLast" type="string">
<column name="NAME_LAST" length="40" not-null="true" />
</property>

[
Name and version of the database you are using:
Oracle9

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
...
[org.hibernate.persister.entity.AbstractEntityPersister] - Hydrating entity: [ca.ubc.nmc.contacts.db.NcContact#1371]
[org.hibernate.type.StringType] - returning 'STAF' as column: ROLE1_0_
[org.hibernate.type.StringType] - returning 'UBC' as column: ORG3_1_0_
[org.hibernate.type.StringType] - returning null as column: ORG4_1_0_
[org.hibernate.type.StringType] - returning 'BCNT' as column: CLASSIFI5_1_0_
...
[org.hibernate.loader.Loader] - done processing result set (1 rows)
[org.hibernate.jdbc.AbstractBatcher] - about to close ResultSet (open ResultSets: 1, globally: 1)
[org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[org.hibernate.jdbc.AbstractBatcher] - closing statement
[org.hibernate.loader.Loader] - total objects hydrated: 1
[org.hibernate.event.def.DefaultLoadEventListener] - loading entity: [ca.ubc.nmc.contacts.db.NcRoleTypeTbl#STAF]
[org.hibernate.event.def.DefaultLoadEventListener] - creating new proxy for entity
[org.hibernate.event.def.DefaultLoadEventListener] - loading entity: [ca.ubc.nmc.contacts.db.NcClassifTypeTbl#BCNT]
[org.hibernate.event.def.DefaultLoadEventListener] - creating new proxy for entity
[org.hibernate.event.def.DefaultLoadEventListener] - loading entity: [ca.ubc.nmc.contacts.db.NcContact#86]
[org.hibernate.event.def.DefaultLoadEventListener] - creating new proxy for entity
...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 19, 2006 7:26 pm 
Beginner
Beginner

Joined: Wed Nov 02, 2005 3:29 pm
Posts: 20
Forgot the NcOrgUnit mapping:

<hibernate-mapping>
<class name="ca.ubc.nmc.contacts.db.NcOrgUnit" table="NC_ORG_UNIT">
<composite-id name="id" class="ca.ubc.nmc.contacts.db.NcOrgUnitId">
<key-property name="orgUnitId" type="string">
<column name="ORG_UNIT_ID" length="10" />
</key-property>
<key-property name="orgUnitTypeCde" type="string">
<column name="ORG_UNIT_TYPE_CDE" length="4" />
</key-property>
</composite-id>
<many-to-one name="lastUpdtBy" class="ca.ubc.nmc.contacts.db.NcContact" fetch="select">
<column name="LAST_UPDT_BY" precision="10" scale="0" />
</many-to-one>
<property name="orgUnitName" type="string">
<column name="ORG_UNIT_NAME" length="64" not-null="true" />
</property>
<property name="comments" type="string">
<column name="COMMENTS" length="1024" />
</property>
<property name="lastUpdtDate" type="timestamp">
<column name="LAST_UPDT_DATE" length="7" />
</property>
<set name="ncContacts" inverse="true">
<key>
<column name="ORG_UNIT_ID" length="10" />
<column name="ORG_UNIT_TYPE" length="4" />
</key>
<one-to-many class="ca.ubc.nmc.contacts.db.NcContact" />
</set>
</class>
</hibernate-mapping>


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.