-->
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: Dirty Read on associations
PostPosted: Thu Dec 01, 2005 5:03 pm 
Newbie

Joined: Wed Nov 30, 2005 3:45 pm
Posts: 10
Location: Vancouver. B.C.
Hi:

For some reason I am getting the following error "Dirty Key" error when doing a simple select on the database for this object. Can anyone see what I am doing wrong or give me any similar experiences that may point me in the right direction of resolving this?

Thanks, Alex.


[com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations#com.t.ccs.adminRouting.model.po.SkillsetAdminKey@9de5b[skillsetName=ab_adsl_service,configID=1]], was: [com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations#com.t.ccs.adminRouting.model.po.SkillsetAdminKey@9de5b[skillsetName=ab_adsl_service,configID=1]]
##PEM com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin.configID is dirty

Hibernate version:
2.1.6

Mapping documents:

hibernate-mapping>
<class
name="com.t.ccs.adminRouting.model.po.SkillsetAdmin"
table="SkillsetAdmin"
dynamic-update="false"
dynamic-insert="false"
>

<composite-id
name="id"
class="com.t.ccs.adminRouting.model.po.SkillsetAdminKey"
>
<key-property
name="skillsetName"
type="java.lang.String"
column="skillsetName"
length="40"
/>

<key-property
name="configID"
type="java.lang.Integer"
column="configID"
/>

</composite-id>

<property
name="skillsetType"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="skillsetType"
length="20"
not-null="true"
/>

<set
name="skillsetSiteAssociations"
lazy="false"
inverse="false"
cascade="all"
sort="unsorted"
>

<key>
<column name="skillsetName" not-null="true"/>
<column name="configID" not-null="true"/>
</key>


<one-to-many
class="com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin"/>
</set>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-SkillsetAdmin.xml
containing the additional properties and place it in your merge dir.
-->
</class>


<hibernate-mapping>
<class
name="com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin"
table="SkillsetSiteAssociationAdmin"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="id"
type="java.lang.Integer"
>
<generator class="assigned">
</generator>
</id>

<property
name="skillsetName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="skillsetName"
length="40"
not-null="true"
/>

<property
name="siteName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="siteName"
length="30"
not-null="true"
/>

<property
name="percentage"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="percentage"
length="10"
not-null="true"
/>

<property
name="phoneNumber"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="phoneNumber"
length="11"
not-null="true"
/>

<property
name="configID"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="configID"
not-null="true"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-SkillsetSiteAssociationAdmin.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
#PEM collection fully initialized: [com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations#com.t.ccs.adminRouting.model.po.SkillsetAdminKey@9de5b[skillsetName=ab_adsl_service,configID=1]]
##PEM 1 collections initialized
##PEM collection initialized
##PEM commit
##PEM flushing session
[Loaded net.sf.hibernate.util.IdentityMap$IdentityMapEntry]
##PEM processing cascades for: com.t.ccs.adminRouting.model.po.SkillsetAdmin
[Loaded net.sf.hibernate.type.ForeignKeyDirection]
[Loaded net.sf.hibernate.type.ForeignKeyDirection$1]
[Loaded net.sf.hibernate.type.ForeignKeyDirection$2]
##PEM cascading to collection: com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations
[Loaded net.sf.hibernate.collection.PersistentCollection$IteratorProxy]
##PEM cascading to saveOrUpdate()
##PEM saveOrUpdate() persistent instance
##PEM cascading to saveOrUpdate()
##PEM saveOrUpdate() persistent instance
##PEM done processing cascades for: com.telus.ccs.adminRouting.model.po.SkillsetAdmin
##PEM Flushing entities and processing referenced collections
[Loaded net.sf.hibernate.impl.AbstractVisitor]
[Loaded net.sf.hibernate.impl.ProxyVisitor]
[Loaded net.sf.hibernate.impl.WrapVisitor]
[Loaded net.sf.hibernate.util.EqualsHelper]
[Loaded net.sf.hibernate.impl.FlushVisitor]
##PEM Collection found: [com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations#com.t.ccs.adminRouting.model.po.SkillsetAdminKey@9de5b[t=ab_adsl_service,configID=1]], was: [com.t.ccs.adminRouting.model.po.SkillsetAdmin.skillsetSiteAssociations#com.t.ccs.adminRouting.model.po.SkillsetAdminKey@9de5b[skillsetName=ab_adsl_service,configID=1]]
##PEM com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin.configID is dirty
##PEM Updating entity: [com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin#6]
[Loaded net.sf.hibernate.exception.NestableDelegate]
##PEM rollback
##PEM transaction completion
##PEM closing session
##PEM disconnecting session
[Loaded net.sf.hibernate.util.JDBCExceptionReporter]
##PEM returning connection to pool, pool size: 1
##PEM transaction completion
[Loaded com.t.ccs.common.storage.TLStorage]
[Loaded com.t.ccs.common.storage.TLStorage$TL]
[Loaded org.apache.commons.lang.time.DateFormatUtils]
[Loaded org.apache.commons.lang.time.FastDateFormat]
[Loaded org.apache.commons.lang.time.FastDateFormat$Rule]
[Loaded org.apache.commons.lang.time.FastDateFormat$NumberRule]
[Loaded org.apache.commons.lang.time.FastDateFormat$TextField]
[Loaded org.apache.commons.lang.time.FastDateFormat$UnpaddedNumberField]
[Loaded org.apache.commons.lang.time.FastDateFormat$Pair]
[Loaded org.apache.commons.lang.time.FastDateFormat$CharacterLiteral]
[Loaded org.apache.commons.lang.time.FastDateFormat$TwoDigitMonthField]
[Loaded org.apache.commons.lang.time.FastDateFormat$TwoDigitNumberField]
[Loaded org.apache.commons.lang.time.FastDateFormat$TimeZoneNumberRule]
[Loaded java.text.resources.LocaleElements_en_US from /bea/jdk131_06/jre/lib/rt.jar]
[Loaded java.util.ResourceBundle$1 from /bea/jdk131_06/jre/lib/rt.jar]
[Loaded org.apache.commons.lang.time.FastDateFormat$StringLiteral]
##PEM 2005.12.01-10:05:53 ivrapp02.ent.agt.ab.ca UNTITLED ERROR com.telus.ccs.util.DAO [ -1 Read failed:
net.sf.hibernate.PropertyValueException not-null property references a null or transient value: com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin.configID ]
Exception in thread "main" com.t.ccs.base.DataAccessException: null; nested exception is net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin.configID
at com.t.ccs.util.DAO.read(DAO.java:113)
at test.SkillsetDAOtest.main(SkillsetDAOtest.java:36)
[Loaded java.lang.Shutdown$Lock from /bea/jdk131_06/jre/lib/rt.jar]


Name and version of the database you are using:
Oracle 9
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: Incorrect error
PostPosted: Thu Dec 01, 2005 6:04 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
As you can see from the actual exception, this isn't a dirtry read:

Exception in thread "main" com.t.ccs.base.DataAccessException: null; nested exception is net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: com.t.ccs.adminRouting.model.po.SkillsetSiteAssociationAdmin.configID

You have a java.lang.Integer property which is null in your POJO being written to a not-null DB column. You're finding out about this during your select because that's when hibernate got around to flushing your previous insert.

A few asides: you shouldn't use type="java.lang.Integer" or type="java.lang.String" without good reason. Use type="integer" or type="string" instead.
Also, please use code tags ([code]...[/code ]) when posting large amounts of code, including mapping XML, to the forums.


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.