I’m trying to call preinsert on a service that extends an object. The preinsert on virtual entity service is not firing. I’m on railo 4.1. I saw a lot of orm related bug on railo, so I consider this is another one. Could you confirm? Should I switch to good old query?
I’ve read the documentation. However what is not clear to me is this: if virtual entity service inherits baseorm, why if I create a service that extends my Category.cfc this service does not fire preinsert?
To be more clear: I have a category.cfc object, a CategoryService that extends category.cfc. In categoryService I would like to create a preInsert method to make some operations before I insert the object in database.
Why if I use preinsert on my service this will be not fired?
preInsert() should be part of object which will be saved. Like in your example you have category.cfc, if this object have method preInsert() then it will be executed.
Because even though your service extends ORM Entity, ORM Entity is not loaded as the service. ColdFusion will only load ORM Entities when it needs the data, not what extends it.