Ticket #130 (new defect)
Opened 11 months ago
DAO Generator's update/delete methods' where clause not generated unless table has id column
| Reported by: | johughes | Owned by: | dhughes |
|---|---|---|---|
| Type: | defect | Priority: | highest |
| Milestone: | Component: | Documentation | |
| Version: | Severity: | blocker | |
| Keywords: | Cc: |
Description
I realized that my many-to-many relationships with reactor weren't working properly on deletes.
Reactor was generating delete and update methods in objectDao.cfc like this:
<cffunction name="delete" access="public" hint="I delete a record in the listing_attached table." output="false" returntype="void"> <cfargument name="to" hint="I am the transfer object for listing_attached which will be used to delete from the table." required="yes" type="any" _type="reactor.project.Niblock.To.listing_attachedTo" /> <cfset var Convention = getConventions() /> <cfset var qDelete = 0 /> <cfquery name="qDelete" datasource="#_getConfig().getDsn()#" username="#_getConfig().getUsername()#" password="#_getConfig().getPassword()#"> DELETE FROM #Convention.FormatObjectName(getObjectMetadata())# WHERE </cfquery> </cffunction>
With the where clause missing. Poking around a bit led me to discover that this was because my join tables have no id columns. This is how I normally construct joining tables in my schemas, as I normally have no need for an ID column. If Reactor requires Id columns in joining tables, this should be documented, and should throw an exception upon not finding them.
Note: See
TracTickets for help on using
tickets.

