[Coldbox 4.1][ColdFusion 11]

Hi All,

Getting an error with our models and orm that we can’t seem to pin down.
Error

“Error”,“ajp-bio-8012-exec-9”,“06/20/19”,“11:36:16”,“497A451DFF3C2290B98D4FF0CCDD8AAD”,"cannot simultaneously fetch multiple bags The specific sequence of files included or processed is: D:\path to file\index.cfm’’

We have our model

“loans” (equipment)

“items”

a loan can have many items and an item can have many loans

if we include the following code in the “loans” model or the reverse in the “items” model we get the error above.

all research indicates that if we use lazy=true then this should resolve the error.

but no luck

can anyone provide a solution?

property

name=“items”

fieldtype=“many-to-many”

cfc=“models.items.Item”

singularname=“item”

fetch=“join”

fkcolumn=“lid”

inversejoincolumn=“iid”

inverse=“false”

linktable=“loan_items”

foreignkeyname=“FK_loans_items”

lazy=“true”

type=“array”

cascade=“all”

;

A few questions for you:

Why use “fetch=join”? This will basically try to do a join on the relationship on the first shot and cost you in performance. I would suggest removing it and adding lazy=“extra”. Unless you find it ultra necessary to have ALL items ready to go in your loan.

Also, you have cascade = all, but inverse = false. In this case it seems you have a bi-directional relationship, and you must choose who is in control, if not, Hibernate doesn’t know which cascade to do, from the loan or from the item up and basically just flops.

If you have a Loan which has items, and an item that belongs to a loan, you need to chose the controlling relationship. I would suggest you make the Loan the controlling relationship. This means that if you save a loan, all its chidlren items will be cascaded either in save/update or delete. Thus, make inverse=true and change the cascade to “all-delete-orphan” to avoid orphan records on the loan. Also, you forgot to show the many to one from the item.