tracker issue : CF-3043870

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 86951:The hasXXX method of a one-to-many relationship returns False when it has a non-persisted element

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 06/21/2011

Components: ORM Support

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 1

Problem:

The hasXXX method of a one-to-many relationship returns False when it has a non-persisted element.
Method:

With ormsettings.flushatrequestend = false;/** Invoice.cfc */component persistent="true"{property name="id" fieldtype="id" generator="native";/** order by oldest to newest */property name="payments" type="array" fieldtype="one-to-many" cfc="Payment" fkcolumn="invoiceID" singularname="payment" inverse="true" cascade="all-delete-orphan";}/** Payment.cfc */component persistent="true" discriminatorcolumn="type"{property name="id" type="numeric" setter="false" fieldtype="id" generator="native" column="paymentID"; property name="approved" type="boolean" required="true" default="true" notnull=true sqltype="bit";property name="invoice" type="Invoice" fieldtype="many-to-one" cfc="Invoice" fkcolumn="invoiceID";}<!-- populateDB.cfm --><cfscript>i = entityNew("invoice");entitySave(i);writeDump(i);</cfscript><!--- run.cfm ---><cfscript>i = entityLoadByPK("Invoice",1);p = entityNew("Payment");i.addPayment(p);p.setInvoice(i);writeDump(i.hasPayment());    // "NO"writeDump(i.getPayments());   // show payment in array, hmm...writeDump(i.hasPayment());    // "YES"</cfscript>
Result:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3043870

External Customer Info:
External Company:  
External Customer Name: Henry Ho
External Customer Email: 237A22C24921EDF5992015B9
External Test Config: 06/21/2011

Attachments:

Comments: