//Primary Key
property name="orderID" fieldtype="id" generator="native" setter="false";
property name="cartID" default="0";
property name="orderNumber";
property name="accountID" default="0";
property name="hasChildren" formula="SELECT COUNT(*) FROM `order` o WHERE o.product = productID" setter="false" getter="true";
since the property hasChildren has a reserved word of order as a table name, it must be wrapped in ` like `order` in order for the mysql driver to properly execute the statement. The above would result in the following SQL code
SELECT COUNT(*) FROM order0.`order` o WHERE o.product = productID
However if I were to change the name of the table to orders
if this hasChildren property had something like "SELECT COUNT(*) FROM orders o WHERE o.productID = productID
it would work just fine AND results as SELECT COUNT(*) FROM order0 o WHERE o.productID = productID
It appears to me that lucee is not understanding `order` is a proper table name for mysql and thus creating invalid SQL statements.